summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahil Momin <rahil.rules.you@gmail.com>2015-03-19 15:37:42 +0530
committerRahil Momin <rahil.rules.you@gmail.com>2015-03-19 15:37:42 +0530
commit1b1d10e2d9b7493039382f0f6020e82d317d0c52 (patch)
treea3fcfbc7b6939c6723c5bd640b44cf8fca707979
parenta6ea67e733d9ecede6c2d29d42a983ae4ffb4506 (diff)
add include? method on arrays
-rw-r--r--ruby.html.markdown3
1 files changed, 3 insertions, 0 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index 1883d1ad..800f0445 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -169,6 +169,9 @@ array[1..3] #=> [2, 3, 4]
# Add to an array like this
array << 6 #=> [1, 2, 3, 4, 5, 6]
+# Check if an item exists in an array
+array.include?(1) #=> true
+
# Hashes are Ruby's primary dictionary with keys/value pairs.
# Hashes are denoted with curly braces:
hash = { 'color' => 'green', 'number' => 5 }