Created
September 4, 2019 18:36
-
-
Save kaipyroami/98cb0565c9ad32eff404a772044260cd to your computer and use it in GitHub Desktop.
Channel example using a buffer.
This file contains hidden or 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() { | |
c := make(chan int, 1) // Buffer | |
c <- 42 | |
fmt.Println(<-c) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment