---
id: list-first
name: List.first
category: list
kind: namespace-method
tokens: List.first
sig: List.first(s) -> T
tip: The first element of a slice.
order: 3
ns: List
member: first
---
Returns element 0 of s — the same as s[0], named for readability. The slice must hold at least one element; calling it on an empty slice reads out of bounds, so guard with List.len(s) > 0 when that is possible. Use it to peek at the head of a queue or the front of an ordered list.
Parameters:
- `s` — a non-empty slice
```ludic
program Queue {
state QueueState {
waiting: []int = new []int
}
handler Serve(queue_st: QueueState) phase Update {
if List.len(queue_st.waiting) > 0 {
let next = List.first(queue_st.waiting)
}
}
}
```