Skip to content

Instantly share code, notes, and snippets.

@junftnt
Forked from slav/multivalChSample.go
Created August 2, 2019 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junftnt/8bb96fd9e35d03775e59f58489bfc69d to your computer and use it in GitHub Desktop.
Save junftnt/8bb96fd9e35d03775e59f58489bfc69d to your computer and use it in GitHub Desktop.
Golang sending sending multiple values through channel
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