NOP Design Home Page


Implements a select/case (also known as switch) branching structure.

Useful when you have one variable that you wish to compare multiple times to take one execution path. Similar to having several if statements in a row.

Select statements begin with a Select (variable) Then, contain one or more case statements, an optional default statement, and end with an EndSelect.

The case expression may be any expression (literal or calculated) that evaluates to a simple type, that is, numbers and strings. Lists or database objects cannot be used here unless they are dereferenced to a simple type.

The keyword 'Default' can be used inside of a select to denote an action that should be taken if no matching case statement was found.

Sample Source

MyVariable := "Sample 1"
Select MyVariable Then
   Case "Not It"
      Say "Location 1"
   Case "Still Not It"
      Say "Location 2"
   Case "Sample 1"
      Say "Here I am!"
      Say "I wasn't any of them!"

Minimum version: 3.0