> 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/indexoflast.md).

# indexOfLast

식을 만족하는 값중 마지막 인덱스를 반환한다.

```kotlin
public inline fun <T> List<T>.indexOfLast(predicate: (T) -> Boolean): Int {
    val iterator = this.listIterator(size)
    while (iterator.hasPrevious()) {
        if (predicate(iterator.previous())) {
            return iterator.nextIndex()
        }      
    }
    return -1
}


val list = listOf(1, 2, 3, 4, 5)
println(list.indexOfLast{ it < 3 })  // 1
```
