summaryrefslogtreecommitdiffhomepage
path: root/ruby.html.markdown
diff options
context:
space:
mode:
authorArthur Vieira <arthur-vieira@users.noreply.github.com>2015-08-26 03:15:36 -0300
committerArthur Vieira <arthur-vieira@users.noreply.github.com>2015-08-26 03:15:36 -0300
commitc00ac0de6612feb54bf0b6d1040c953e2de5df81 (patch)
tree37260282d94bc4117ad3966ac5cab34f26ea9add /ruby.html.markdown
parentaca299f45116aebbde8d037efff49a0a1aa5c8e1 (diff)
Add #push to Array besides shovel operator
#push is commonly used imho and it is also used in other languages (e.g. Javascript).
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r--ruby.html.markdown2
1 files changed, 2 insertions, 0 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index 66a0774d..7bd28d86 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -173,6 +173,8 @@ array[1..3] #=> [2, 3, 4]
# Add to an array like this
array << 6 #=> [1, 2, 3, 4, 5, 6]
+# Or like this
+array.push(6) #=> [1, 2, 3, 4, 5, 6]
# Check if an item exists in an array
array.include?(1) #=> true