-
-
Save leonardo5621/16a90032a12866803713acb30817f35f 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) | |
isEven := func(x int) bool { | |
return x % 2 == 0 | |
} | |
for num := range Filter(done, range10, isEven) { | |
fmt.Println(num) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment