mirror of
https://github.com/rjNemo/underscore
synced 2026-06-09 03:56:49 +00:00
* change documentation theme and structure * add config files * fix links * add build doc command Co-authored-by: Ruidy <rnemausat@newstore.com>
21 lines
270 B
Markdown
21 lines
270 B
Markdown
---
|
|
title: "Last"
|
|
date: 2022-03-21T13:46:24-04:00
|
|
---
|
|
|
|
`Last` returns the last element of the slice.
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
u "github.com/rjNemo/underscore"
|
|
)
|
|
|
|
func main() {
|
|
nums := []int{1, 9, 2, 8, 3, 7, 4, 6, 5}
|
|
|
|
fmt.Println(u.Last(nums)) // 5
|
|
}
|
|
```
|