"repeat for each" in reverse order ?

Mark Smith mark at maseurope.net
Sun Jun 26 14:27:13 EDT 2005


How about

put the keys of myArray into kList
  repeat for each line L in kList
   put cr & L before newKlist
  end repeat
delete char 1 of newKlist

  repeat for each line L in newKlist
    --doStuff
end repeat

It's two loops, admittedly, but unless it's a very big array, it'd be 
really quick.
You could also put the first loop into a separate function if you need 
to do this in many different places in your code.


Cheers,

Mark Smith


On 25 Jun 2005, at 18:57, Phil Davis wrote:

> It sounds like you're looking for a feature that doesn't yet exist (or 
> at least I'm not aware of it). I could see having a property that 
> defines the direction in which the 'repeat for each' structure does 
> its looping, like this:
>
>   set the repeatDirection to "descending" -- or "down", "reverse", ???
>   repeat for each element x in y
>     -- actions
>   end repeat
>
> That would be a nice feature indeed. No harm in requesting it!
>
> Phil Davis
>
>
>
> jbv wrote:
>> Hi list,
>> Is there a way to use
>> "repeat for each element thisIndexTerm in listOfTerms"
>> in reverse order, like in
>> "repeat with i=number of items of myVar down to 1" ?
>> Thanks,
>> JB
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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