Single Line if Statements in MQL4

 

Hello

Can someone show me how to write 1 line if /else statements?

For example I have this  statement with A and B being two variables.

 

if (A==0) B=0;

else B=A+10;

How can you make it into 1 line?

Thank you

 
Michalis Phylactou:
 

How can you make it into 1 line?

// either
B = A != 0 ? A + 10 : 0;
// or
B = A == 0 ? 0 : A + 10;
 
James Cater:

or ...

if (A==0) B=0; else B=A+10;
Reason: