Add #push to Array besides shovel operator

#push is commonly used imho and it is also used in other languages (e.g. Javascript).
This commit is contained in:
Arthur Vieira 2015-08-26 03:15:36 -03:00
parent aca299f451
commit c00ac0de66

View File

@ -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