Navigation:  ThinBASIC language > Program Flow >

Select

Previous pageReturn to chapter overviewNext page

 

Description

 

Control program flow based on the value of an expression.

 

Syntax

 

SELECT CASE SelectExpression

                                                                '<<<NO CODE is permitted here

CASE test

   {statements}

 

 [CASE test

   {statements}]

 

 [CASE ELSE

   {statements}]

 

END SELECT

 

Returns

 

Parameters

 

Remarks

 

The following CASE tests are supported:

Test

Description

CASE Value

SelectExpression will be compared to Value for equality

CASE Value1 TO Value2

SelectExpression must be between Value1 and Value2

CASE > Value

SelectExpression must be greater than Value

CASE >= Value

SelectExpression must be greater or equal to Value

CASE < Value

SelectExpression must be less than Value

CASE <= Value

SelectExpression must be less or equal to Value

CASE = Value

SelectExpression must be equal to Value

CASE <> Value

SelectExpression must be different than Value

CASE Value1, Value2, ...

SelectExpression must be one of the listed values

 

 

Restrictions

 

No code is permitted between a SELECT CASE and the very first CASE statement.

Empty SELECT CASE/END SELECT (without any CASE statement defined inside the block) will generate runtime error.

 

See also

 

SelectExpression

 

Examples