Files
lo/docs/data/core-first.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

573 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
First first find.go#L554 core find https://go.dev/play/p/94lu5X6_cbf
core#find#first
core#slice#take
core#slice#takewhile
core#find#firstor
core#find#firstorempty
core#find#last
core#find#lastor
core#find#lastorempty
core#find#nth
260
func First[T any](collection []T) (T, bool)

Returns the first element of a collection and whether it exists.

v, ok := lo.First([]int{1, 2, 3})
// v == 1, ok == true