Array methods

.length()

Return the number of elements contained in the target array.

array.length() => Integer
โ€‹
// example
do val = ["Batman", "Robin", "Superman"]
do val.length() // 3

.push(*)

Add an element at the end of an array.

array.push(val) => void
โ€‹
// example
do val = ["Batman", "Superman"]
do val.push("Robin") // ["Batman", "Superman", "Robin"]

.pop()

Remove the last element of an array.

array.pop() => void
โ€‹
// example
do val = ["Batman", "Robin", "Superman"]
do val.pop() // ["Batman", "Robin"]

.insert_at(Integer, *)

Add an element at position n of an array (shifting the position of all the following elements).

array.insert_at(n, val) => void
โ€‹
// example
do val = ["Batman", "Superman"]
do val.insert_at(1, "Robin") // ["Batman", "Robin", "Superman"]

.remove_at(Integer)

Remove the nth element of an array (unshifting the position of all the following elements).

array.remove_at(n) => void
โ€‹
// example
do val = ["Batman", "Robin", "Superman"]
do val.remove_at(1) // ["Batman", "Superman"]