Returning value from keyPressed

I need a way to return a value from keyPressed (or some user input from keyboard) stored in a variable and have not been able to find any way of doing so. I would like it to be something like below. I'm new to Processing, but have done a bit of C++, so I am trying to find a way around cin >> from C++.

String keyPressed() { if (key == '\n' ) { saved = typing; typing = ""; } else { typing = typing + key; } return saved; }

Tagged:

Answers

Sign In or Register to comment.