FAQ

On Fri, Nov 29, 2013 at 12:34 PM, Dmitry Vyukov wrote:
The shorter form is:
I'd expect this even shorter form to work the same (not tested):

package main

func main() {
         inchan := make(chan int)
         outchan := make(chan int)
         exitc := make(chan int)
loop:
         for {
                 select {
                 case outchan <- <-inchan:
                 case <-exitc:
                         break loop
                 }
         }
}

http://play.golang.org/p/56UTFUGUw8

-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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 11 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 29, '13 at 11:31a
activeNov 29, '13 at 12:30p
posts11
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase