Last Modified: 1/17/2021
Executes code based on the value of the Variable used in the opening statement.
Name | Type | Required | Description |
Variable | Integer / Long | Yes | The Variable to check the value of. |
Syntax: Select Case <Variable>, <Quantity> Case 0 [Code] Exit Case Case Else [Code] Exit Case End Select |
a = 2 Select Case a Case 0 Print "A is < 3" Exit Case Case 3 Print "A = 3" Exit Case Case Else Print "A > 3" Exit Case End Select |
Case values must be numerical, and must be in order. If you omit values in between 2 Case statements, and the value of Variable falls in between those numbers, the code to execute will default to the lower Case block.
Skipping Case numbers will still insert those numbers into the jump table. If you have a large difference, you could be artificially bloating the compiled code. Consider using values that are close to each other.