Search…
Array Functions

Syntax
array.repeat(number int)
Makes an array with the given element number of times.
foo := [1, 2].repeat(5)
println(foo)
Output
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2]

Syntax
array.delete(ix int)
Deletes the element present in the array at index ix.
mut even_numbers := [2, 4, 6, 8, 10]
even_numbers.delete(3)
println(even_numbers)
Output
[2, 4, 6, 10]

Syntax
array.reverse()
Reverses the array.
float_num := [1.1, 1.3, 1.25, 1.4]
float_num.reverse()
Output
[1.4, 1.25, 1.3, 1.1]

Syntax
array.clone()
Clones and returns a new array.
foo := [1, 2, 4, 5, 4, 6]
foo1 := foo.clone()
println(foo1)
Output
[1, 2, 4, 5, 4, 6]
Last modified 2yr ago
Copy link
On this page
repeat
delete
reverse
clone