MathTop

drop_right 函数

丢弃列表末尾的 count 个元素。

语法

  • drop_right(list, count)

参数与选项

list形如 [1, 2, 3] 的列表字面量。
count要从末尾移除的元素数量。

示例

  1. 丢弃末尾元素drop_right([x, y, z, w], 2)返回 [x, y]。