SELECT

Top  Previous  Next

Action

Executes one of several statement blocks depending on the value of a variable.

 

 

Syntax

SELECT CASE var

CASE test1 : statements

 [CASE test2 : statements ]

CASE ELSE : statements

END SELECT

 

 

Remarks

var

Variable. to test

Test1

Value to test for.

Test2

Value to test for.

 

 

See also

IF THEN

 

 

Example

Dim b2 as byte

SELECT CASE b2                'set bit 1 of  port 1

CASE 2 : PRINT "2"

CASE 4 : PRINT "4"

CASE IS >5 : PRINT ">5"        'a test requires the IS keyword

CASE 10 TO 20                 'test the range from 10 to 20

CASE ELSE

END SELECT

END