The conditional operator evaluates a Boolean expression (the first operand) and based on the result returns one of two other operands.
If the Boolean operand is TRUE, the result of the operator is the second operand (the THEN clause), otherwise the third operand is returned (the ELSE clause). The second and the third operand must be the same type.
Only one clause of this operator is ever evaluated. In other words, if the THEN clause (operand) is evaluated, the ELSE clause (operand) is not evaluated. (And the opposite is also true.)
Examples:
"JUAN" = "juan" ? "YES" : "NO"
Result = "NO"
"JUAN" ~= "juan" ? "YES" : "NO"
Result = "YES"
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |