On Mon, Jul 4, 2016 at 5:08 PM Kenshin Wang <kenshinsy...@gmail.com> wrote:

        go func(i int) {
                for {
                        next <- i
                        i++
                }
        }(start)

> could anyone can explain why the output is this?

A goroutine dies when it returns. A goroutine with an endless loop is
immortal (modulo unhandled panics).

-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to