Reverse an array

This commit is contained in:
Chashmeet Singh 2015-10-05 20:32:00 +05:30
parent 51e3bd21e2
commit 0beb78ac43

View File

@ -170,7 +170,7 @@ array[2, 3] #=> [3, 4, 5]
# Reverse an Array # Reverse an Array
a=[1,2,3] a=[1,2,3]
a[::-1] #=> [3,2,1] 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]