Repeat for each loop assistance, please.

Edwin Gore edgore at shinra.com
Sun Aug 3 00:56:00 EDT 2003


Scott's method (adding a counter) is absolutely the right way to go. Others
on the list have benchmarked this, and it's MUCH faster than doing the for x
= etc. etc. etc. method.


----- Original Message ----- 
From: "yoy" <yoy at comcast.net>
To: <use-revolution at lists.runrev.com>
Sent: Saturday, August 02, 2003 11:08 PM
Subject: Re: Repeat for each loop assistance, please.


> Whoa!
>
> Scott, here I thought everybody was in bed but me.
>
> Many thanks!
>
> Andy
>
> ----- Original Message ----- 
> From: "Scott Rossi" <scott at tactilemedia.com>
> To: <use-revolution at lists.runrev.com>
> Sent: Sunday, August 03, 2003 12:55 AM
> Subject: Re: Repeat for each loop assistance, please.
>
>
> > Recently, yoy wrote:
> >
> > > repeat for each line gameLine in fld "gamelist"
> > >
> > > I need to obtain the line number for the current iteration. I'm error
> > > checking for the number of items in gameLine and if it isn't equal to
5,
> I
> > > want to raise an answer dialog and stop the script, then hilight that
> line
> > > in fld "gameList".
> > >
> > > The other problem is that the variable might be 6 with the first 5
items
> > > isolated and the 6th item examined under different circumstances, ala
> > > checking a lotto game with or without a bonus ball number.
> > >
> > > It has only been two days of my trial.
> > >
> > > What can I query to get the iteration number of this loop?
> >
> >
> > Sounds like you want to use a counter to get the iteration.
> >
> > put 1 into N
> > repeat for each line L in fld "gameList"
> >   put number of items of L into T
> >   if T <> 5 then
> >     answer "Incorrect number of items." titled "Error"
> >     set the hilitedLines of fld gameList to N
> >     exit to top
> >   end if
> >   # do other stuff here
> >   add 1 to N
> > end repeat
> >
> >
> > Regards,
> >
> > Scott Rossi
> > Creative Director
> >
> > Tactile Media, Multimedia & Design
> > Email: scott at tactilemedia.com
> > Web: www.tactilemedia.com
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list