Back to Lo

It Fill

docs/data/it-fill.md

1.53.0300 B
Original Source

Fill replaces elements of a sequence with initial value.

go
collection := func(yield func(int) bool) {
    yield(1)
    yield(2)
    yield(3)
}

filled := it.Fill(collection, 99)
var result []int
for item := range filled {
    result = append(result, item)
}
// result contains [99, 99, 99]