Files
lo/docs/data/it-fromseqptror.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

669 B

name, slug, sourceRef, category, subCategory, signatures, variantHelpers, playUrl, similarHelpers, position
name slug sourceRef category subCategory signatures variantHelpers playUrl similarHelpers position
FromSeqPtrOr fromseqptror it/type_manipulation.go#L11 it type
func FromSeqPtrOr[T any](collection iter.Seq[*T], fallback T) iter.Seq[T]
it#type#fromseqptr
https://go.dev/play/p/LJ17S4pvOjo
242

FromSeqPtrOr returns a sequence with the pointer values or the fallback value.

one := 1
var two *int = nil

collection := func(yield func(*int) bool) {
    yield(&one)
    yield(two)
}

values := it.FromSeqPtrOr(collection, 99)
var result []int
for val := range values {
    result = append(result, val)
}
// result contains [1, 99]