how to get last element in array ruby code example
Example 1: get last item in array ruby
array = [1, 2, 3]
array.last
Example 2: how to call the last array in ruby
array = [1, 2, 3]
array[-1]
array = [1, 2, 3]
array.last
array = [1, 2, 3]
array[-1]