Open vkorbes opened 3 years ago
solução 1: https://play.golang.org/p/2D84B7z781O solução 2: https://play.golang.org/p/4PPAfh7W5Tx
https://play.golang.org/p/cmBIx9_9gfH
package main
import (
"fmt"
)
func main() {
c := make(chan int)
go func() {
c <- 42
}()
fmt.Println(<-c)
}
Output
42
Program exited.
https://play.golang.org/p/xO9iOSsbmWH
package main
import (
"fmt"
)
func main() {
c := make(chan int, 1)
c <- 42
fmt.Println(<-c)
}
Output
42
Program exited.
buffer: https://go.dev/play/p/xO9iOSsbmWH go func: https://go.dev/play/p/0KEjX2prAIG
package main
import (
"fmt"
)
func main() {
c := make(chan int)
go func() {
c <- 42
}()
fmt.Println(<-c)
}
Exercício: Capítulo 22, Exercício 1 (Nível: 10)
Use esta thread para compartilhar sua solução, discutir o exercício com os colegas e pedir ajuda caso tenha dificuldades!