Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
dbosst
Apprentice


Joined: 15 Jun 2010
Posts: 121

PostPosted: 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
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
dbosst
Apprentice


Joined: 15 Jun 2010
Posts: 121

PostPosted: 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...
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Aug 05, 2010 4:52 pm   
 
Confirmed and added to bug list. Definitely a weird one.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net