Version: v0.5.1 - Beta.  We welcome contributors & feedback.  THanks!

List.pop

pop()

Description

Remove and return the last item in a List.

This function is the opposite of push.

To remove an element elsewhere in a List, use remove.

RememberThe terms “push” and “pop” come from a spring-loaded stack of plates in a cafeteria. The top-most plate is “popped” off, and new plates are “pushed” onto the stack.

let letters = ['a', 'b'];

letters.push('X');
//= ['a', 'b', 'X']

letters.pop();
//= 'X'

print(letters);
//= ['a', 'b']

See Also