Back to Lo

Core Nthor

docs/data/core-nthor.md

1.53.0202 B
Original Source

Returns the element at index nth of collection, or the fallback if out of bounds. If nth is negative, returns the nth element from the end.

go
v := lo.NthOr([]int{10, 20, 30}, 10, -1)
// v == -1