pop

Removes the last item from a list and returns that item.

This function changes the length of the list. The pop() function works on a list type array, but not on a tuple since tuples are immutable.

This function generates a change (except when called on a variable).

Function

list.pop()

Arguments

None

Return value

The removed item from the list. A lookup_err() is raised if the list is empty.

Example

This code show an example usage of pop():

(list = [1, 2, 3]).pop();  // 3
list;

Return value in JSON format

[
    1,
    2
]