Reverse an array

This commit is contained in:
Chashmeet Singh 2015-10-05 17:51:23 +05:30
parent e57fb68756
commit cae1960ca3

View File

@ -168,6 +168,10 @@ array[-1] #=> 5
# With a start index and length
array[2, 3] #=> [3, 4, 5]
# Reverse an Array
# array = [1,2,3]
array.reverse #=> [3,2,1]
# Or with a range
array[1..3] #=> [2, 3, 4]