PSL Compound Statements


PSL compound statements include loop statements and if statements. In PSL, a sequence of statements can be treated as one statement by enclosing it in braces {}. We will call this a statement (BLOCK} and denote it in the statement descriptions as . The following compound statements can be used to alter or change the flow of control in a PSL program:

if (expression) {BLOCK}
if (expression) {BLOCK} else {BLOCK}
if (expression) {BLOCK}
elsif (expression) {BLOCK}
. . . else {BLOCK}

foreach variable (array) {BLOCK}
foreach unit variable (array) {BLOCK}
switch(variable)
{ case m: {BLOCK}
. . .
case n: {BLOCK}
default: {BLOCK}
while (expression) {BLOCK}

do {BLOCK} until (expression);

for ([initexpr];[termexpr];[reinitexpr]) {BLOCK}

Note

Compound statements are defined in terms of statement blocks, not statements. This means that the braces are required rather than optional. No dangling statements are allowed.

 

Where to go from here

PSL-Statements