We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › labels to break/continue nested loops
Page Index Toggle Pages: 1
labels to break/continue nested loops (Read 465 times)
labels to break/continue nested loops
Oct 1st, 2007, 2:57pm
 
Hello everybody,

I'm using nested loops and whish I could use labels to break/continue through more than one nested level, but Processing doesn't recognize my labels and doesn't process the loops at all. It says : Invalid type:22.

Doesn't Processing support labels at all?

Here is the kind of code I would like to execute without getting an error (it's just a stupid example) :

firstLoop:
for (int i = 0; i < 10; i++) {
 for (int j = 0; j < 10; j++) {
   if ((i+j) % 5 != 0) continue firstLoop;
   System.out.println(i + " " + j);
 }
}

Thank you.
Re: labels to break/continue nested loops
Reply #1 - Oct 2nd, 2007, 2:48pm
 
hi nicolas,

I've had the same problem. The error message seems to be thrown by the processing preprocessor. I've tried your code in a processing sketch in eclipse, and it works as expected.

Maybe we should report a bug for this one?

**Edit: reported it as a bug http://dev.processing.org/bugs/show_bug.cgi?id=631


Re: labels to break/continue nested loops
Reply #2 - Oct 2nd, 2007, 10:00pm
 
Thank you for your reply, and for reporting the bug in the db! ;-)
Page Index Toggle Pages: 1