Skip to content

Instantly share code, notes, and snippets.

@leonardo5621
Last active July 24, 2022 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonardo5621/bdacb898118d03076eda457faeb68fce to your computer and use it in GitHub Desktop.
Save leonardo5621/bdacb898118d03076eda457faeb68fce to your computer and use it in GitHub Desktop.
func main() {
done := make(chan struct{})
defer close(done)
// Generates a channel sending integers
// From 0 to 9
range10 := rangeChannel(done, 10)
multiplierBy10 := func(x int) int {
return x * 10
}
for num := range Map(done, range10, multiplierBy10) {
fmt.Println(num)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment