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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Jezuit
Beginner


Joined: 02 Nov 2002
Posts: 27
Location: USA

PostPosted: Fri Dec 12, 2003 10:31 pm   

"Breaking" from a loop
 
Is there a way to, when using #FORALL and running through a string list variable, when something in that list matches something I'm looking for, then stop the remaining execution of that #FORALL? IE - Let's say I'm searching through #FORALL for something that matches %1. I would just:

#FORALL @thisismystringlist {#IF (%i = %1) {do something;STOP the rest of the forall}}

How do I perform that second command? Is there one to do such thing?
Reply with quote
moksha
Novice


Joined: 13 Oct 2002
Posts: 37
Location: United Kingdom

PostPosted: Fri Dec 12, 2003 10:44 pm   
 
Hello

I think the command you need is #ABORT.

Moksha
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Sat Dec 13, 2003 3:56 am   
 
You'd need to use the #abort in a special way, because if you put it inside the #IF statement, it will only stop the #IF statement, not the #forall.
Something like this would work:
#alias abortalias {}
#forall @thisismystringlist {Do-This;#IF (%i = %1) {#alias abortalias {#abort}};abortalias}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Dec 13, 2003 9:36 am   
 
Wouldn't it be simpler to just check the list?
#IF (%ismember( "%1", @thisismystringlist)) {do something}
No loop, so no need to stop one either.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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