Created
June 23, 2018 08:05
-
-
Save broccoli1002/92c8a98a5d07efd137fd706ae19b2bfc to your computer and use it in GitHub Desktop.
スターティングGO言語:送受信について p188
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
package main | |
import ( | |
"fmt" | |
) | |
func receiver(ch <-chan int) { | |
for { | |
i := <-ch | |
fmt.Println(i) | |
} | |
} | |
func main() { | |
ch := make(chan int) | |
go receiver(ch) | |
i := 0 | |
for i < 10000 { | |
ch <- i | |
i++ | |
} | |
fmt.Println("Hello, playground") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment