continue;
Use the continue statement in the body of a C-style for loop, while, or do-while statement to skip the rest of the statements in the body of the loop and start again from the top of the loop.
for ( oneuser in userlist ) { if (oneuser == "root") { continue; } print(oneuser); }
dostatement while ( expression ) ;
The do-while statement is a looping statement. It repeatedly runs the specified statement until the specified expression evaluates to false (the value 0) or it encounters a break statement.
The specified statement runs at least once (unlike the while statement, which may terminate immediately).
Use a statement block in the form { statement ... } to run multiple statements in the loop. One Identity recommends using a statement block for readability.
This prints the values 1,2,3,4,5:
x=1; do print(x++); while (x <= 5);
This prints the values 1,2,3,4,5 using a statement block:
x = 1; do { print(x); x++; } while (x <= 5);
This prints the values 1,2,3 because the break statement terminates the loop:
x=1; do { if (x > 3) break; print(x++); } while (x <= 5);
for ControlValue = StartValue to StopValue
[step increment] { initializer statements ; conditional expression ; update expression ; initializer statements ; conditional expression ; }
The for statement is a looping statement. It runs one or more initializer statements and then evaluates the conditional expression. Use a comma to separate multiple initializer statements. If the conditional expression evaluates to true (any non-zero value), then it runs the specified statement. It runs the update expression (if present) immediately after it runs the specified statement. The for statement is terminated if the conditional expression evaluates to false (the value 0), or it encounters a break statement.
Typically, a for statement contains one initializer statement, a conditional expression, and an update expression that all operate on the same variable.
Use a statement block in the form { statement ... } to run multiple statements. One Identity recommends using a statement block for readability.
This prints the values 1,2,3,4,5:
for (x = 1; x <= 5; x++) print(x);
This prints the values 1,2,3,4,5. (Note that this example does not have an update expression and it uses a statement block):
for (x = 1; x <= 5; ) { print(x); x++; }
This prints the values 1,2,3 because the break statement terminates the loop:
for (x = 1; x <= 5; x++) { if (x > 3) break; print(x); }
for (variable in expression ) statement
The for statement is a looping statement. The specified expression must be an array. It runs the specified statement once for each array element, and assigns it to the specified variable in turn. The for statement terminates when the specified expression does not evaluate to an array value, either when each element of the array has been iterated, or it encounters a break statement.
Use a statement block in the form { statement ... } to run multiple statements. One Identity recommends using a statement block for readability.
This prints the values 1,2,3,4,5:
for (x in {1,2,3,4,5}) print(x);
This does not print any value, since the expression does not evaluate to an array:
for (x in "foo") print(x);
This prints the values 1,2,3 because the break statement terminates the loop:
values = {1,2,3,4,5}; for (x in values) { if (x > 3) break; print(x); }
© ALL RIGHTS RESERVED. 이용 약관 개인정보 보호정책 Cookie Preference Center