We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm using nested loops to search for a match inside a function, (eg. getMatch), but when I finally find my match, I want the function to stop looping. I've found the noLoop() but it seems to be only for draw()? What other way can I stop a for loop from continuing?
Tried exit() too, but I don't want to quit the program. I basically want to pause the loop so I can click on things inside the screen once the match has been made.
Thanks!
Answers
http://processing.org/reference/break.html
Hmm yes, this seems to be right. but I don't think it's working quite right for me. I can use this inside many layers inside of a nested loop, right?
condensed code of interest:
You could use a boolean var and while loop combination.
Here is pseudocode.
Or perhaps use the boolean var in the test clause of your for loop.
Thanks - very good idea!
"I can use this inside many layers inside of a nested loop, right?"
I suppose you meant "can't".
Little known fact (and rarely used): you can break from an inner loop to the outer one (whatever the level of nesting).
Close of goto (reserved work in Java, not implemented) and only usage of label (the line with :).