|
Jezuit Beginner
Joined: 02 Nov 2002 Posts: 27 Location: USA
|
Posted: 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? |
|
|
|
moksha Novice
Joined: 13 Oct 2002 Posts: 37 Location: United Kingdom
|
Posted: Fri Dec 12, 2003 10:44 pm |
Hello
I think the command you need is #ABORT.
Moksha |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: 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} |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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. |
|
|
|
|
|