-
-
Save junftnt/8bb96fd9e35d03775e59f58489bfc69d to your computer and use it in GitHub Desktop.
Golang sending sending multiple values through 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 f(c chan func() (int, string)) { | |
c <- (func() (int, string) { return 0, "s" }) | |
} | |
func main() { | |
c := make(chan func() (int, string)) | |
go f(c) | |
y, z := (<-c)() | |
fmt.Println(y) | |
fmt.Println(z) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment