Skip to content

Instantly share code, notes, and snippets.

@xin053
Last active July 5, 2019 07:51
Show Gist options
  • Save xin053/8860309761e53748f1a049914ded2a15 to your computer and use it in GitHub Desktop.
Save xin053/8860309761e53748f1a049914ded2a15 to your computer and use it in GitHub Desktop.
[go for循环] for 循环 #go #for
for init; condition; post {}
// 如同 c 的 while
for condition {}
// 死循环
for {}
// 遍历数组,切片,字符串,map等
for key, value := range aList {}
// 只取 key
for key := range aList {}
// 只取 value
for _, value := range aList {}
// 二维数组 for 循环节省内存
for i := range [3][]int{} {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment