The control structures of SPLASH are similar to those in C and Java.
if (temperature < 0) { display := 'below zero'; } else if (temperature = 0) { display := 'zero'; } else { display := 'above zero'; }The switch statement selects from a number of alternatives:
switch (countryCode) { case 1: continent := 'North America'; break; case 33: case 44: case 49: continent := 'Europe'; break; default: continent := 'Unknown'; }The expression after the switch can be an integer, long, money, money(n), float, date, timestamp, or bigdatetime.
integer i := 0, squares := 0; while (i < 10) { squares := squares + (i * i); i++; }This example uses the operator ++ to add 1 to the variable i. The break statement exits the loop, and continue starts the loop again at the top.
Finally, you can stop the execution of a block of SPLASH code with the exit statement. This statement doesn't stop the Event Stream Processor, just the block.