Download G Programming Reference Manual

Transcript
Chapter 18
Structures
The For Loop is equivalent to the following pseudocode:
for i = 0 to N – 1
Execute subdiagram
While Loop
A While Loop executes its subdiagram until a Boolean value you wire
to the conditional terminal is FALSE. G checks the conditional terminal
value at the end of each iteration, and if the value is TRUE, another
iteration occurs, so the loop always executes at least once. The default
value of the conditional terminal is FALSE, so if it is unwired, the loop
iterates only once.
The iteration terminal behaves exactly as it does in the For Loop.
conditional terminal
The While Loop is equivalent to the following pseudocode:
Do
Execute subdiagram (which sets condition)
iteration terminal
While condition is TRUE
Both loop structures can have terminals called shift registers that you
use for passing data from the current iteration to the next iteration. See
the Shift Registers section of this chapter for more information.
Placing Objects inside Structures
You can place an object inside a structure by dragging it inside, or by
building the structure around the object.
You cannot put an object inside a structure by dragging the structure
over the object. If you move a structure and it overlaps another object,
your application displays the object it considers to be in front. If you put
the structure completely over another object, and your application
makes it the frontmost object, it displays a thick shadow to warn you
that the object is below, not inside the structure. Otherwise, the
structure is hidden completely by the object. (For information on which
objects your application selects as frontmost, see the section
Positioning Objects in Chapter 2, Building VIs.) Both situations are
shown in the following illustration.
G Programming Reference Manual
18-4
© National Instruments Corporation