You can add things to the end of the array by pushing data into it : Push « Array « Ruby






You can add things to the end of the array by pushing data into it


x = []
x << "Word"
puts x

 








Related examples in the same category

1.Blow Your Stack
2.With arrays, << is the operator for pushing an item onto the end of an array.
3.Push integer and string to the same array
4.Push an array to another array