As shown, no more than one clause ever executes. Control does not “fall through” from one clause to the next.

Continue

The continue statement returns control to the start of a block of code controlled by a for, forEach, or while statement. The statement lets you return to a labeled statement of one of those kinds, or to the nearest embedding statement of one of those kinds.

The code displays each integer on its own line, inserting a blank line after each group of three.

Exit

The exit statement exits from a function, program, service, or run unit; or from a block of code controlled by a case, for, forEach, if, or while statement.

For

The for statement runs a set of statements in a loop that repeats until a counter exceeds a specified value.

The example code shows three variations of a for statement that adds the same set of numbers.

program MyTestProgram
function main()
inputList int[]=[10, 4, 6, 8, 2];
numberInList int= inputList.getSize();
sum =0;// the first for loop increments by 1.for(i int from 1 to numberInList)
sum = inputList[i]+ sum;
end
SysLib.writeStdOut("sum after the first for loop is "+ sum);
sum =0;// the second for loop has the same effect but specifies the increment value. for(i int from 1 to numberInList by 1)
sum = inputList[i]+ sum;
end
SysLib.writeStdOut("sum after the second for loop is "+ sum);
sum =0;// the third for loop starts at the opposite side of the list and decrements by 1for(i int from numberInList to 1 decrement by 1)
sum = inputList[i]+ sum;
end
SysLib.writeStdOut("sum after the third for loop is "+ sum);
end
end

In each case, the variable i was local to the for statement. Here is an alternative:

i int;for(i from 1 to numberInList)
sum = inputList[i]+ sum;
end

After that code ends, the value of i is available and equals numberInList + 1.

If

The if statement runs a set of statements if a logical expression resolves to true. The optional else keyword marks the start of an alternative set of statements that run only if the logical expression resolves to false.

The following code shows how to embed If statements in other If statements.