while (wait) { }
in
Programming Questions
•
2 years ago
How come this program doesn't work? It i so simple.
There is a loop, waiting for a keyPress on each iteration.
The program outputs "0", then just stops there
boolean wait;
void setup() {
size (200,200);
background (128);
loop();
for (int i = 0; i < 5; i++) {
print(i);
wait=true;
while (wait) {
}
}
}
size (200,200);
background (128);
loop();
for (int i = 0; i < 5; i++) {
print(i);
wait=true;
while (wait) {
}
}
}
void draw() {
}
}
void keyPressed() {
print("K");
wait=false;
}
print("K");
wait=false;
}
1