View Subcategory

Remove an element from a list by index

Given the list [Apple, Banana, Carrot], remove the first element to produce the list [Banana, Carrot]
fantom
list := ["Apple", "Banana", "Carrot"]
list.removeAt(0)

Remove the last element of a list

fantom
list := ["Apple", "Banana", "Carrot"]
list.removeAt(-1)
list := ["Apple", "Banana", "Carrot"]ยจ
list.pop

Rotate a list

Given a list ["apple", "orange", "grapes", "bananas"], rotate it by removing the first item and placing it on the end to yield ["orange", "grapes", "bananas", "apple"]
fantom
list := ["apple", "orange", "grapes", "bananas"]
list.add(list.removeAt(0))