Extended for: Added explanation of continue.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
e7dbd5f44ea79a3eb41e4535575197b9eadc0e03
|
||||
mGqqcBZ0jv
|
||||
0567bfd0e134cfd06f893c445dae72dd8d6064f6
|
||||
egSvQrHmW6
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user