reverse of list

Hi,

Does anyone know which way is better. This:

set l to {}
repeat with i from 10 to 1 by -1
	set end of l to i
end repeat

or this:

set l to {}
repeat with i from 1 to 10
	set end of l to i
end repeat
reverse of l

Otherwise I need to get out the timer. :slight_smile:
Thanks,
kel

I wouldn’t say better, but the first one has one command less. As far for repeat loops, there is no performance difference in going up or down in iteration. So adding the set command at the end of the second example should be marginally slower, but I doubt if it’s even measurable.

Hi DJ Bazzie Wazzie,

So, there’s no performance difference in the decrement way. That’s what I was wondering.

Thanks a lot,
kel