Reversing an Array
Your array is the wrong way around: the last item should be first and the first should be last.
[1,2,3].reverse # => [3, 2, 1] [1,[2,3,4],5].reverse # => [5, [2, 3, 4], 1]
Like many operations on basic Ruby types, reverse has a corresponding method, reverse!, which reverses an array in place:
Don't reverse an array if you just need to iterate over it backwards. Don't use a for loop either; the reverse_each iterator is more idiomatic.