---
title: "pop"
url: https://una-lang.org/en/docs/std/builtin/pop/
release: v0.4.0
edition: "0.5 preview"
source: https://github.com/una-lang/una/blob/v0.4.0/docs/std/builtins.json
---

# pop

A built-in method, resolved by the type of its receiver ([`spec/14 §2`](https://una-lang.org/en/docs/spec/14-standard-library/#s2)). Edition 0.5 preview.

```una
edit s.pop() -> Option[T]
  where s: Stack[T]
edit q.pop() -> Option[T]
  where q: Queue[T]
edit q.pop() -> Option[T]
  where q: PriorityQueue[T, P]
```

Updates the receiver in place, written `let x = edit s.pop()`: it removes the top of a `Stack` or the front of a `Queue` and gives it as `Some`, or gives `None` and leaves an empty one as it is, in O(1) amortized time (`spec/28 §5`). A `PriorityQueue` gives its item of the first priority, the one pushed first among equal priorities, in O(log n) comparisons, amortized (`spec/28 §8`).

## Specification

- `spec/28 §5`
- `spec/28 §8`

Generated from una v0.4.0 ([`docs/std/builtins.json`](https://github.com/una-lang/una/blob/5fec93d88932b333feec25e589355a2cb34c37b5/docs/std/builtins.json), which is not part of the specification): built-in methods have no declaration, so una writes these signature lines and tests each against its checker. The specification governs: [`spec/14 §2`](https://una-lang.org/en/docs/spec/14-standard-library/#s2).
