2020-11-08 【Ruby】マイナスのインデックスで最後の文字や要素を指定する number = [ 0, 1, 2, 3, 4 ] number[-1] # => 4 参考 https://qiita.com/jnchito/items/dedb3b889ab226933ccf