summaryrefslogtreecommitdiffhomepage
path: root/ruby.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2015-10-05 13:22:17 -0500
committerLevi Bostian <levi.bostian@gmail.com>2015-10-05 13:22:17 -0500
commitd1a822f96c88855b2cbb649a4ea7b452e4104164 (patch)
tree8c0fe7c4b0c9e45056d9343b6ef322b0d4c5c4b6 /ruby.html.markdown
parentd3519b2269b9fbe56ad1da4ebf2e34389e02f2ab (diff)
parent0beb78ac436d232ce73986848f354fc4e7210dfb (diff)
Merge pull request #1353 from chashmeetsingh/patch-4
Reverse an array
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r--ruby.html.markdown4
1 files changed, 4 insertions, 0 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index 7bd28d86..8f23b2e6 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -168,6 +168,10 @@ array[-1] #=> 5
# With a start index and length
array[2, 3] #=> [3, 4, 5]
+# Reverse an Array
+a=[1,2,3]
+a.reverse! #=> [3,2,1]
+
# Or with a range
array[1..3] #=> [2, 3, 4]