Last active
October 20, 2017 13:26
-
-
Save tigercallme/d4a4ae90a180a80dfa5cfeae2ee8bc5a to your computer and use it in GitHub Desktop.
Revisions
-
tigercallme revised this gist
Oct 20, 2017 . No changes.There are no files selected for viewing
-
tigercallme revised this gist
Oct 20, 2017 . 1 changed file with 3 additions and 1 deletion.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 @@ -2,4 +2,6 @@ for range time.Tick(30 * time.Millisecond) { doSomthing() } //time.Tick()返回的是一个channel,每隔指定的时间会有数据从channel中出来, //for range不仅能遍历map,slice,array还能取出channel中数据,range前面可以不用变量接收, //所以可以简写成上面的形式。 -
tigercallme created this gist
Oct 20, 2017 .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,5 @@ for range time.Tick(30 * time.Millisecond) { doSomthing() } //time.Tick()返回的是一个channel,每隔指定的时间会有数据从channel中出来,for range不仅能遍历map,slice,array还能取出channel中数据,range前面可以不用变量接收,所以可以简写成上面的形式。