MSL compound statements include loop statements and if statements. In MSL, a sequence of statements can be treated as one statements by enclosing in braces {}. We will call this a statement block and denote it in the statement descriptions as {BLOCK}. The following compound statements can be used to alter or change the flow of control in a MSL program:
if (expression) {BLOCK}
if (expression) {BLOCK} else {BLOCK}
foreach variable in (array) {BLOCK}
foreach variable, variable in (array) {BLOCK}
foreach variable in (hash) {BLOCK}
foreach variable, variable in (hash) {BLOCK}
function name(argument list, …) {BLOCK}
switch (variable) {
case a: {BLOCK}
. . .
case z: {BLOCK}
default: {BLOCK}
}
while (expression) {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.