|
dbosst Apprentice
Joined: 15 Jun 2010 Posts: 121
|
Posted: Wed Aug 04, 2010 8:42 pm
3.22 #continue breaks #break in loops |
Using #continue in a loop stops all #break commands in successive iterations of the loop from working correctly:
Example of it breaking:
Code: |
#loop 1,10 {#if (%i < 5) {#show continue %i;#continue}; #if (%i >= 5) {#show break %i;#break}; #show next %i}
continue 1
continue 2
continue 3
continue 4
break 5
break 6
break 7
break 8
break 9
break 10
|
Here is the expected output with code that is supposed to be equivalent (with the continue implied using if/else ):
Code: |
#loop 1,10 {#if (%i < 5) {#show continue %i} {#if (%i >= 5) {#show break %i;#break}; #show next %i}}
continue 1
continue 2
continue 3
continue 4
break 5
|
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Aug 04, 2010 10:25 pm |
I think this might be an issue of code-block level. #continue/#break are probably operating on the level of the #IF code block rather than the one for the #loop. I vaguely recall that there were/are some similar issues with #ABORT.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
dbosst Apprentice
Joined: 15 Jun 2010 Posts: 121
|
Posted: Wed Aug 04, 2010 10:33 pm |
I know what you are thinking but #break is definitely not operating at that level.. as you can see the second example works fine .. and #break stops the entire loop, even though it is within a nested if even
I know from my compiler class in college, in complicated flow control like this its easy to have bugs in the compiler... |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Aug 05, 2010 4:52 pm |
Confirmed and added to bug list. Definitely a weird one.
|
|
|
|
|
|