## Begin Case / Case / End Case (Statement)

### Description

The **case** structure allows the programmer to create a structure to test multiple conditions. Only the first true condition is executed and all of the other conditions are skipped. If there is an optional **else** as the last condition this will be executed if no other conditions are met.

### Example

for t = 1 to 10
begin case
case t < 3
print t + " is less than 3"
case t < 7
print t + " is less than 7 but 3 or larger"
else
print t + " is 7 or larger"
end case
next t

displays:

1 is less than 3
2 is less than 3
3 is less than 7 but 3 or larger
4 is less than 7 but 3 or larger
5 is less than 7 but 3 or larger
6 is less than 7 but 3 or larger
7 is 7 or larger
8 is 7 or larger
9 is 7 or larger
10 is 7 or larger

### See Also

Begin Case / Case / End Case, Call, Continue Do, Continue For, Continue While, Do / Until, End, Exit Do, Exit For, Exit While, For / Next, Function, Global, Goto, Gosub, If Then, Pause, Ref, Rem, Return, Subroutine, While / End While

### History