Created
September 6, 2016 06:58
-
-
Save legendtkl/1061b7e3d0becf45cb6bfabf78a292cf to your computer and use it in GitHub Desktop.
Revisions
-
legendtkl created this gist
Sep 6, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ package main import ( "fmt" ) func main() { for i:=0; i<10; i++ { go fmt.Println(i) } for i:=0; i<10; i++ { j := i go fmt.Println(j) } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ package main import ( "fmt" ) func makeEvenGenerator() func() uint { i := uint(0) return func() (ret uint) { ret = i i += 2 return } } func main() { nextEven := makeEvenGenerator() fmt.Println(nextEven()) fmt.Println(nextEven()) fmt.Println(nextEven()) }