15 pts.
 function block calculation module
Hello,

I would like to know how to read this code and what the outcome would be. its writtin in a calculation function block which typically includes IF-THEN-ELSE, DO-WHILE, etc. statements.

out1 := (in2 = 0) ? 0 : ((in1 & in3) > 0);

of course in1/2/3 are the inputs, out1 is the output. Is this a type of IF-THEN-ELSE short-hand?

Thank you;

ASKED: Oct 15, 2011  0:08 AM GMT
UPDATED: October 17, 2011  8:08:07 PM GMT
66,925 pts.
  Help
 Approved Answer - Chosen by Carlosdl

Is this a type of IF-THEN-ELSE short-hand?

It seems likely to mean something like:
if (in2 = 0) then out1 = 0 else out1 = ((in1 & in3) > 0) ;

But it's hard to tell because you haven't told us what language it is written in.

Tom
ANSWERED:  Oct 16, 2011  2:04 AM (GMT)  by TomLiotta   66,925 pts.

 
Answer Wiki:
Last Wiki Answer Submitted:  Oct 15, 2011  0:08 AM (GMT)  by  Mkemaleddine   15 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _




Is this a type of IF-THEN-ELSE short-hand?

It seems likely to mean something like:

if (in2 = 0) then out1 = 0 else out1 = ((in1 & in3) > 0) ;

But it’s hard to tell because you haven’t told us what language it is written in.

Tom

 66,925 pts.

 

I was able to play with the software. It is a simple ST (Structured Text) code. once I tested a few IO it was obvious that it is indeed an IF-THEN-ELSE structure, known as “?:” operator.
TomLiotta thanks for your reply. your presumption was correct.

 15 pts.