I wasn't entirely sure whether this should go under
"Interpreter Core" or "Parser/Compiler", but whatever.
At the moment, "break" and "continue" can only break
out of the innermost "for" loop. I would appreciate a
way of breaking out of multiple 'for' or 'while' loops.
This would be extremely useful for instance when you
have some 'for' loops cycling through several
combinations, and you are using another 'for' loop to
check their validity (in my example, checking that my
two values are co-prime). In this situation, the only
solution I have found is to create a boolean variable
that is assigned a value when the check fails, just
before 'break'-ing out of a 'for' loop, and immediately
after that 'for' loop, having a statement that checks
the status of the boolean variable, and then
'continue's or 'breaks' again accordingly. I'm not an
experienced programmer, but this strikes me as
inefficient :p
Sorry if the above explanation is muddled. I can send a
short (15 lines) bit of code which might explain it better.
BTW, PHP seems to do this with "break 2;" or "continue
2;" which is very useful.
--G
|