We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to add a while loop to my code .
Something like while ENTER is pressed println "you are pressing enter" .
Can someone please help me ?
Is this code goes into the void draw() ?
What would the code be for that ?
Answers
See the reference for while
and for keyPressed and key
It won’t work in my opinion. Draw() updates keyPressed only at the end of draw and not during while. iirc
But try
int i=0;
while (i<10) {
println(i);
i++;
}
println („done“); use normal „“ here
You should not use a while loop. You should use a boolean and an if statement.
To explain more why the first approach won't work: