---
id: list-len
name: List.len
category: list
kind: namespace-method
tokens: List.len
sig: List.len(s) -> int
tip: The number of elements in a slice.
order: 0
ns: List
member: len
---
Returns how many elements s currently holds. It reads the slice's length, which changes as you List.push and List.pop, and is the same value as the bare len(s). Use it to bound a loop, test for emptiness, or find the last index with List.len(s) - 1.
Parameters:
- `s` — the slice to measure
```ludic
program CountEnemies {
state CountEnemiesState {
enemies: []int = new []int
}
handler Report(count_enemies_st: CountEnemiesState) phase Update {
let n = List.len(count_enemies_st.enemies)
}
}
```