Created
January 15, 2016 07:46
-
-
Save hackintoshrao/2718167c1865150aa6af to your computer and use it in GitHub Desktop.
non blocking single write into the channel
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() { | |
//building a bridge for one person | |
//its important to specify the data type the bridge would carry | |
bridgeForOne := make(chan int, 1) // specifying the size of the bridge to be one | |
//lets onboard a integer onto the bridge | |
bridgeForOne <- 1 | |
fmt.Println("Integer sent onto the bridge") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment