how to find last elemnet in ruby array code example Example: how to find last elemnet in ruby array a[-1] # => 5 b[-1] # => 6