Go language continue Statement
Go language statements continue a bit like a break statement. But not continue out of the loop, but skip the current loop is executed the next loop.
for loop, continue the implementation of the statement will trigger the execution for incremental statement.
grammar
continue syntax is as follows:
continue;
continue statement is a flow chart is as follows:
Examples
package main import "fmt" func main() { /* 定义局部变量 */ var a int = 10 /* for 循环 */ for a < 20 { if a == 15 { /* 跳过此次循环 */ a = a + 1; continue; } fmt.Printf("a 的值为 : %d\n", a); a++; } }
The above examples Implementation of the results:
a 的值为 : 10 a 的值为 : 11 a 的值为 : 12 a 的值为 : 13 a 的值为 : 14 a 的值为 : 16 a 的值为 : 17 a 的值为 : 18 a 的值为 : 19