EnglishРусский  

Ads

Installer and installation software
Commercial and Freeware installers.

The conditional operator ?

The conditional operator ? operates in the similar way as the if-else statement, but the conditional operator can be located in the expression. The operator is a ternary operator (it takes three operands). The operands separated by commas are enclosed in parentheses; the first logical (integer) expression is evaluated. If the value is nonzero (TRUE), the second expression will be evaluated, the value of which will be a result of the conditional operation. Otherwise, the third operand will be evaluated, the value of which will be returned.

r = ?( a == 10, a, a + b ) 
if a >= ?( x, 0xFFF, ?( y < 5 && y > 2, y, 2*b )) + 2345
{
   ...
}