Created
September 4, 2019 18:34
-
-
Save kaipyroami/8480446b23390e6b3d85c623503907fd to your computer and use it in GitHub Desktop.
Channel using function example.
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() { | |
c := make(chan int) | |
go func() { | |
c <- 42 | |
}() | |
fmt.Println(<-c) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment