Extended for: Added explanation of continue.

This commit is contained in:
Manuel Hutter
2016-01-22 15:05:12 +01:00
parent d3d265b3e4
commit e23cb95e59
4 changed files with 40 additions and 4 deletions

View File

@@ -26,4 +26,12 @@ func main() {
fmt.Println("loop")
break
}
// You can also `continue` to the next loop
for n := 0; n <= 9; n++ {
if n%2 == 0 {
continue
}
fmt.Println(n)
}
}

View File

@@ -1,2 +1,2 @@
e7dbd5f44ea79a3eb41e4535575197b9eadc0e03
mGqqcBZ0jv
0567bfd0e134cfd06f893c445dae72dd8d6064f6
egSvQrHmW6

View File

@@ -6,6 +6,11 @@ $ go run for.go
8
9
loop
1
3
5
7
9
# We'll see some other `for` forms later when we look at
# `range` statements, channels, and other data