-
-
Save leonardo5621/6c8cb9597e37a4c4502a107efe19a0b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
done := make(chan struct{}) | |
defer close(done) | |
// Generates a channel sending integers | |
// From 0 to 9 | |
range10 := rangeChannel(done, 10) | |
for num := range takeFirstN(done, range10, 5) { | |
fmt.Println(num) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment