Re: reverse indexing (was RE: Ruby and WMI)


#1

Sean O’Halpin [mailto:removed_email_address@domain.invalid]:

#Did you know you can use reverse_each?

of course, there is even each :slight_smile:

but i am suggesting this:

x=[0,1,2,3,4,5] =>[1,2,3,4,5]
x[-1…-6] =>[5,4,3,2,1]
x[-3…-4] =>[3,2]

right now, the above return empty [].

kind regards -botp

#x = (0…5).to_a
#x.reverse_each do |i|

print i

#end
##=> 54321

#Regards,

#Sean