To add an element to the end of an array in Ruby, you can use the push
method. This will append the specified element to the end of the array.
main.rb45 chars4 lines
Alternatively, you can use the <<
operator, which also appends an element to the end of an array.
main.rb42 chars4 lines
gistlibby LogSnag