Case Statements

A case statement is a statement that jumps to 1 of the branches based on a value. It can be used with integers, enumerations and strings. If the value isn't present as a branch the case jumps to the else, or to the next statement. Case supports ranges by using the .. operator.

case value of
  0: Console.WriteLine('Executes if value = 0');
  1: Console.WriteLine('Executes if value = 1');
  2: Console.WriteLine('Executes if value = 2');
  6..9: Console.WriteLine('Executes if value = 6,7,8 or 9');
  else
    Console.WriteLine('Executes for all other values');
end;