Includes solved 02-worker-pool and 09-safe-counter (mutex, atomic, sharded). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GbnJj9ZqEx9nUvzkjdwfMq
15 lines
225 B
Go
15 lines
225 B
Go
// PREDICT each printed line, and what the last statement does.
|
|
package main
|
|
|
|
import "fmt"
|
|
|
|
func main() {
|
|
ch := make(chan int, 2)
|
|
ch <- 1
|
|
close(ch)
|
|
fmt.Println(<-ch)
|
|
v, ok := <-ch
|
|
fmt.Println(v, ok)
|
|
close(ch) // ???
|
|
}
|