 |
zwanth Beginner
Joined: 13 Jul 2002 Posts: 16 Location: USA
|
Posted: Wed Jan 14, 2004 1:14 am
%i and nested LOOP/FORALL |
If I have two FORALLs and/or LOOPs nested, is there a way I can get the current index for the innermost loop?
For example:
#LOOP 5 {
#FORALL @stringlist {
#SAY %i
...
}
}
The %i in this example gives me the current index from the outer loop(1,2,3,4,5) and not the string list in #FORALL. Is there a way to get the current name from @stringlist, or a better way to script this? |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Jan 14, 2004 1:58 am |
%j
#LOOP 5 {
#FORALL @stringlist {
#SAY %j
...
}
} |
|
|
 |
zwanth Beginner
Joined: 13 Jul 2002 Posts: 16 Location: USA
|
Posted: Wed Jan 14, 2004 2:31 am |
%j is exactly what I needed... This really should be added to the Predefined Variables list in the help file.
Thanks for your assistance. |
|
|
 |
patryn Apprentice
Joined: 26 Sep 2001 Posts: 124
|
Posted: Thu Jan 15, 2004 11:44 pm |
Wow, very handy.
I always made use of temporary variables, which no doubt slowed the computing of such algorithms down a lot.
Thanks Lightbulb, you just made made my settings twice as efficient as they used to be  |
|
|
 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Sep 08, 2005 1:06 am |
Just curious LightBulb (or anyone) where did the %j come from?
I mean, how did you know about it? Help file in zmud, also online make no ref to %j.
just wondering if maybe something like this would make my assembly question come together..
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=22007
Prolly not tho..*sigh* |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Sep 08, 2005 2:16 am |
I know it's in the version notes (or rather, that it appeared there; if Zugg had to rebuild those as well I guess it could be possible it might have been forgotten), and I know that Zugg did announce this on the forums when first released. May not have survived the move to wolfpaw, though.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Sep 08, 2005 4:08 am |
sadly cant search for %j otherwise i woulda found that :(
Thanks |
|
|
 |
Private Adept
Joined: 10 Jan 2002 Posts: 264 Location: USA
|
Posted: Thu Sep 08, 2005 3:56 pm |
the 1st loop is %i, loops/foralls/etc nested inside that use %j,%k,%l,etc
enter this on the command line:
Code: |
#loop 1 {
#loop 2 {
#loop 3 {
#loop 4 { #SHOW I: %i - J: %j - K: %k - L: %l
}
}
}
}
|
Last Loop Output:
Code: |
I: 1 - J: 2 - K: 3 - L: 4
|
|
|
|
 |
|
|