Ruby: What is the easiest way to remove the first element from an array?

后端 未结 11 1735
渐次进展
渐次进展 2020-12-12 11:54

Lets say I have an array

[0, 132, 432, 342, 234]

What is the easiest way to get rid of the first element? (0)

11条回答
  •  遥遥无期
    2020-12-12 12:27

    "pop"ing the first element of an Array is called "shift" ("unshift" being the operation of adding one element in front of the array).

提交回复
热议问题