How to invert Array values

change array values

arr = #(1,2,3,4,5,6,7,8,9,10)

Does anyone know how to reverse Array values to be like this:

invarr = #(10,9,8,7,6,5,4,3,2,1)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

invarr = for i = arr.count to 1 by -1 collect arr[i]

bga

draging's picture

exactly

thanks barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.