Chapter 12 Case and Sequence Structures and the Formula Node
BridgeVIEW User Manual 12-2 © National Instruments Corporation
Case StructureThe Case structure has two or more subdiagrams, or cases, exactly one of
which executes when the structure executes. This depends on the value
of an integer, Boolean, string, or enum value you wire to the external side
of the selection terminal or selector. A Case structure is shown in the
following illustration.
Note Case statements in other programming languages generally do not execute any
case if a case is out of range. In G, you must either include a default case that
handles out-of-range values or explicitly list every possible input value.
Activity 12-1. Use the Case StructureYour objective is to build a VI that checks a number to see if it is positive.
If the number is positive, the VI calculates the square root of the number;
otherwise, the VI returns an error.
Front Panel
1. Open a new front panel and create the objects as shown in the
following illustration.
The Number control supplies the number. The Square Root Value
indicator displays the square root of the number. The free label acts as
a note to the user.