Pop

From MiniScript Wiki
Revision as of 15:43, 17 March 2020 by 71.226.33.30 (talk) (Created page with "<c>pop</c> removes and returns the last item in a list, or an arbitrary key of a map. If the list or map is empty (or if called on any other data type), returns null. See al...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

pop removes and returns the last item in a list, or an arbitrary key of a map. If the list or map is empty (or if called on any other data type), returns null.

See also: push; pull; remove

Arguments

Parameter Name Default Value Meaning
self list or map object to remove an element from the end of

Usage Notes

pop may be called with function syntax or dot syntax.

Example

[1, 2, 3].pop	// returns (and removes) 3