underscore/last.go
Ruidy fb517f3b04
last function (#17)
* last function

* fix CI

Co-authored-by: Ruidy <rnemausat@newstore.com>
2022-03-21 18:04:30 +01:00

7 lines
139 B
Go

package underscore
// Last returns the last element of the slice
func Last[T any](values []T) T {
n := len(values)
return values[n-1]
}