summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChashmeet Singh <chashmeetsingh@gmail.com>2015-10-05 20:32:00 +0530
committerChashmeet Singh <chashmeetsingh@gmail.com>2015-10-05 20:32:00 +0530
commit0beb78ac436d232ce73986848f354fc4e7210dfb (patch)
tree5c2611c07add86051cb104297ea15c84a493c7d5
parent51e3bd21e29ac19884eca57c6f4f1defbd78ea3a (diff)
Reverse an array
-rw-r--r--ruby.html.markdown2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index b6d0e44d..8f23b2e6 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -170,7 +170,7 @@ array[2, 3] #=> [3, 4, 5]
# Reverse an Array
a=[1,2,3]
-a[::-1] #=> [3,2,1]
+a.reverse! #=> [3,2,1]
# Or with a range
array[1..3] #=> [2, 3, 4]