Merge pull request #1353 from chashmeetsingh/patch-4

Reverse an array
This commit is contained in:
Levi Bostian 2015-10-05 13:22:17 -05:00
commit d1a822f96c

View File

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