Array#pop removes objects from the end of an array and returns what it removed. With no argument, it removes one object; with an integer argument, it removes that many and returns them as an array. section 9.2.2
Remove the last element
a = [1, 2, 3, 4, 5] a.pop # => 5 a # => [1, 2, 3, 4] pop changes the array itself; the removed element is not merely captured. section 9.2.2
Use the argument form when several trailing elements belong together:
- Contrast pop with shift: pop removes from the end, while shift removes from the beginning. section 9.2.2



