How to get the last element of an array in Ruby? code example Example: get last item in array ruby array = [1, 2, 3] array.last