Professional Documents
Culture Documents
Pascal Selection
Pascal Selection
Case statements are designed for multi-way selection. Most languages include some kind
of Case structure; although the term used may differ (eg: Select, Switch).
Syntax:
CASE Variable OF
Value 1:
Statement;
Value 2:
Statement;
ELSE
Statement;
END;
Syntax:
CASE Variable OF
Value 1:
BEGIN;
Statements…;
Statements…;
END;
Value 2:
BEGIN;
Statements…;
END;
ELSE
BEGIN;
Statements…;
END;
END;
Page 1 of 2
Ranges of Options for the Same Statements
Additional options can be separated by commas for multiple values or two dots to
indicate a range.
Syntax
CASE variable of
Value 1, Value 2:
Statement;
Value 3 .. Value 6:
Statement;
Else
Statement;
End;
Page 2 of 2