On Wed, Apr 25, 2018 at 2:27 AM, wrote:
>
> So it always guarantees to print "hello world" for the unbuffered channel,
> doesn't it?
>
> package main
> var c = make(chan int)
> var a string
>
> func f() {
> a = "hello, world"
> c <- 0
> }
>
> func main() {
>
So it always guarantees to print "hello world" for the unbuffered channel,
doesn't it?
package main
*var c = make(chan int)*
var a string
func f() {
a = "hello, world"
*c <- 0*
}
func main() {
go f()
*<-c*
print(a)
}
it will guarantee to print "hello, world".
package