National Instruments BridgeVIEW Manual De Usuario

Descargar
Página de 455
Chapter 12
Case and Sequence Structures and the Formula Node
12-12
© National Instruments Corporation
The following example shows how you can perform a conditional 
assignment inside a Formula Node.
Consider a code fragment that computes the square root of 
x
 if 
x
 is positive, 
and assigns the result to 
y
. If 
x
 is negative, the code assigns –99 to 
y
.
if (x >= 0) then
y = sqrt(x)
else
y = -99
end if
You can implement the code fragment using a Formula Node, as shown in 
the following illustration.
Conditional
Operator
False
Condition
Condition
True
Condition