Select
Description
The Select/Case activity combination (also known as Select/Case statement) runs one of several groups of statements, depending on the value of an expression. In a Select/Case statement, a single expression (most often a variable) is initially evaluated. The value of the expression is then compared with the values for each Case in the structure. If there is a match, the block of steps associated with that Case is executed. Select/Case can be a useful alternative to using an If/Else statement in tasks that need to perform different actions for different decisions. The variation between Select/Case and If/Else is the speed and readability of the resulting task when one of several decisions can be reached. For example, evaluation of a simple expression such as 1=1 (true) or 1>2 (false) is best performed using use the If activity. For more complex decisions where there are several possible answers such as favorite color=red, blue, green or yellow, Select/Case activities would be a better choice. This is because Select/Case presents the task steps in a manner that is more readable, and at runtime, the evaluation of the expression occurs only once rather than needing repeated If activities with individual comparison.
Available activities
For more information about a specific activity, click the associated link:
Activity | Description |
---|---|
Select - Begin case | Executes the steps following this step if the case matches the expression result of an enclosing Begin select step. |
Select - Begin select | Executes the block of steps following the Begin case step matching the result of the specified expression. |
Select - End case | Ends a block of steps started by a preceding Begin case activity. |
Select - End select | Ends a block of steps started by a preceding Begin select activity. |