Using variables in new functions?
in
Programming Questions
•
1 year ago
So I have:
- void setup()
- {
- code here;
- }
- void draw()
- {
- int times = 1;
- if (times == 1)
- {
- println("Press enter to coninue:");
- }
- else
- {
- println("Exiting now!");
- }
- }
- void keyPressed()
- {
- if (key == '\n')
- {
- times = 0;
- }
- } I need to know how to use times in keyPressed and draw. Because whenever I do times = 0 in keyPressed, it says "Cannot find anything named times"
1