get index of last element in ruby code example Example: get last item in array ruby array = [1, 2, 3] array.last