advent-of-code/ranger/channel.go

16 lines
153 B
Go
Raw Permalink Normal View History

2024-04-05 16:27:02 -06:00
package main
func countChan(n int) <-chan int {
ch := make(chan int)
go func() {
for i := range n {
ch <- i
}
close(ch)
}()
return ch
}