Last active
June 23, 2018 07:33
-
-
Save broccoli1002/cf0b00b799aa5c2d8dc80c1d8df74302 to your computer and use it in GitHub Desktop.
スターティングGO言語: チャネルについて p184
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 main() { | |
var ( | |
ch0 chan int | |
ch1 <-chan int // 受信専用 | |
ch2 chan<- int // 送信専用 | |
) | |
ch1 = ch0 | |
ch2 = ch0 | |
// ch0 = ch1 // error | |
// ch0 = ch2 // error | |
//ch1 = ch2 //error | |
fmt.Println("finish") | |
fmt.Println(ch1) | |
fmt.Println(ch2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment