You are on page 1of 2

Case Statements

A Simple CASE Statement

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;

Multiple Statements Within a CASE Statement

Multiple statements must be bracketed with a Begin & an 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

You might also like