add item to array ruby code example
Example 1: how to add to an array ruby
array.push('new element')
# OR
array << 'new element'
Example 2: ruby append to array
array = []
array << "element 1"
array.append "element 2"
puts array
# ["element 1", "element 2"]