Free Pascal supports the case statement. Its prototype is
Case Pivot of Label1 : Statement1; Label2 : Statement2; ... Labeln : Statementn; [Else AlternativeStatement] end;label1 until Labeln must be known at compile-time, and can be of the following types : enumeration types, Ordinal types (except boolean), and chars. Pivot must also be one of these types.
The statements Statement1 etc., can be compound statements (i.e. a begin..End block).
Remark: Contrary to Turbo Pascal, duplicate case labels are not allowed in Free Pascal, so the following code will generate an error when compiling:
Var i : integer; ... Case i of 3 : DoSomething; 1..5 : DoSomethingElse; end;The compiler will generate a Duplicate case label error when compiling this, because the 3 also appears (implicitly) in the range 1..5