Skip to main content

reverse

Function reverse 

Source
pub fn reverse(args: &[Value]) -> Result<Value, RuntimeError>
Expand description

反转数组

§功能

返回一个新数组,元素顺序与原数组相反。原数组不会被修改。

§参数

  • array: Array - 要反转的数组

§返回值

Array - 反转后的新数组

§示例

Set ARR [1, 2, 3, 4, 5]
Set REVERSED REVERSE(ARR)    // [5, 4, 3, 2, 1]
PRINTLN(ARR)                 // [1, 2, 3, 4, 5] (原数组不变)