Ruby:从数组中删除第一个元素的最简单方法是什么? [英] Ruby: What is the easiest way to remove the first element from an array?

查看:26
本文介绍了Ruby:从数组中删除第一个元素的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个数组

[0, 132, 432, 342, 234]

摆脱第一个元素的最简单方法是什么?(0)

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

推荐答案

弹出"数组的第一个元素称为shift" ("unshift"是添加一个元素的操作在数组前面).

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

这篇关于Ruby:从数组中删除第一个元素的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆