github.com/giovannyortegon/go@v0.0.0-20220115155912-8890063f5bdd/BlackHatGo/Chap02/channels_sum.go (about) 1 package main 2 3 import "fmt" 4 5 func strlen(s string, c chan int) { 6 c <-len(s) 7 } 8 9 func main() { 10 11 c := make(chan int) 12 go strlen("Salutations", c) 13 go strlen("World", c) 14 15 x, y := <-c, <-c 16 17 fmt.Println(x, y, x + y) 18 }