I am new to GO
from google. In buffered channels here is a program:
package main
import "fmt"
import "time"
func main() {
c := make(chan int, 2)
c <- 1
fmt.Println(<-c)
time.Sleep(1000 * time.Millisecond)
c <- 2
fmt.Println(<-c)
}
It produces output. But according to http://tour.golang.org/#64 it says:
Sends to a buffered channel block only when the buffer is full. Receives block when the buffer is empty.
As it says it send only when FULL why does the program produce an output instead of waiting infinity for c
to full up at the first statement. ?