AnsweredAssumed Answered

Suggested modification to the IF THEN ELSE object

Question asked by VRFuser on Aug 14, 1997
As Mike Groves pointed out, you can use a formula object to perform conditional operations.  If your logic is more complex than a simple A>B, you can use triadic operations

(A>B ? 1 : 2) will output a 1 if A is greater than B and a 2 otherwise. 

Triadics can be nested of the logic is even more complex.  (A>10 ? (A>100 ? 3 : 2 ) : 1)
Will output a 1 if A is less than 10, 2 if A is greater than 10 and less than or equal to 100, and 3 if A is greater than 100)

With the addition of multiple output pins for formula objects in VEE 4.0 you can set the values on multiple outputs.  OUT1 = (A>B ? 1 : 2), OUT2 = (A=1) would give you a value of 1 or 2 on the OUT1 pin and a value of 0 on the OUT2 pin if A is less than or equal to B or a value of 1 if A is greater than B.

Triadics are very useful tools and can make your program much simpler and faster than using conditional (if-then) structures



Steven Timian
stimian@ara.com

Applied Research Associates
RR1 Box 120 A
Waterman Road
South Royalton, VT 05068

(802) 763 - 8348 phone
(802) 763 - 8283 fax



Outcomes