Permalink
Browse files

you're doing great

  • Loading branch information...
GoesToEleven committed Feb 11, 2017
1 parent 3b3aaa2 commit 6d2d73139c5ee8b929b64ed8941a84fbead8c640
Showing with 45 additions and 0 deletions.
  1. +40 −0 22_go-routines/15_for-fun/01/main.go
  2. +5 −0 22_go-routines/15_for-fun/README.md
@@ -0,0 +1,40 @@
package main
import (
"fmt"
)
func main() {
m := map[int]int{}
m[4] = 7
m[3] = 87
m[72] = 19
ch := make(chan int)
// for closing ch
ch2 := make(chan int)
go func() {
var i int
for n := range ch2 {
i += n
if i == len(m) {
close(ch)
}
}
}()
go func() {
for _, v := range m {
ch <- v
ch2 <- 1
}
}()
for v := range ch {
fmt.Println(v)
}
// good housekeeping
close(ch2)
}
@@ -0,0 +1,5 @@
# New Code
These files were added into this repo after the training was recorded.
There are no lectures associated with these files. However, please peruse them and enjoy them!

0 comments on commit 6d2d731

Please sign in to comment.