method
List.pop
List.pop(s) -> T
Removes the final element of s and returns it, shortening the slice by one. Together with List.push this makes a slice work as a stack: push to add, pop to take the most recent back off. The slice must be non-empty. Use it to unwind a history, process a work list, or undo the last action.
Parameters
sa non-empty sliceExample
program UndoStack {
var history: []int = new []int
handler Undo phase Update {
if List.len(history) > 0 {
let last_action = List.pop(history)
}
}
}