push array in method ruby code example Example: ruby push array array = [1, 2, 3, 4] array.push(5) array # => [1, 2, 3, 4, 5]