> For the complete documentation index, see [llms.txt](https://gold.gitbook.io/kotlin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gold.gitbook.io/kotlin/collections/elements-operations/lastindexof.md).

# lastIndexOf

```kotlin
val list = listOf(1, 2, 3, 4, 5, 5, 5)

println(list.indexOf(5))  // 4
println(list.lastIndexOf(5))  // 6
println(list.lastIndexOf(8))  // -1
```
