Repeat for each item - should it be more robust ?

Martin Blackman martinblackman at gmail.com
Sun Feb 12 08:41:58 EST 2006


(tail between legs) well I guess we have agreement there then, thanks
for reminding me about the docs!

On 12/02/06, Alex Tweedly <alex at tweedly.net> wrote:
> Martin Blackman wrote:
>
> >Try the following script -
> >
> >repeat for each item tItem in "apple,banana,broccoli"
> >if tItem = "broccoli" then put " - vegetable" after tItem else put " -
> >fruit" after tItem
> >answer tItem
> >end repeat
> >
> >Rev answers 'apple - fruit', 'apple  - fruit' and 'broccolli - vegetable'
> >(There is an extra space in the second answer)
> >
> >I know this is messing with the repeat variable which is ill-advised,
> >
> >
> messing with the repeat variable isn't "ill-advised" - it's "not allowed"
> It will cause errors - the docs say that, and they're right.
>
> >but I would have thought rev should be able to handle this.
> >
> >
> When the docs explicitly say
>
> > Important!  You cannot change the labelVariable in a statement inside
> > the loop. Doing so will cause a script error.
>
> I think you should believe them :-)
>
> --
> Alex Tweedly       http://www.tweedly.net
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 10/02/2006
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list