Operators > Programming Operators > Conditional Operators
Conditional Operators
Operator
Description
Evaluates y when x is nonzero (true). The if operator opens conditional statements.
Evaluates y when x is nonzero (true). This happens only when the preceding if or elseif statements are zero (false).
You can only write an elseif statement directly after an elseif or an if statement.
Evaluates y when x is nonzero (true). This happens regardless of whether the preceding if or alsoif statements are zero (false) or nonzero (true).
You can only write an alsoif statement directly after an alsoif or an if statement.
You cannot use the alsoif and elseif statements together in the same if statement.
Evaluates y when the preceding statements are zero (false). The else operator closes conditional statements.
You can only write an else statement at the end of a conditional statement.
Operands
x is any valid expression that can evaluate to 0 in some cases. Only the return value of x is considered; it can be a Boolean expression or any other PTC Mathcad expression. For example, a local assignment or a sequence of programming steps is allowed.
y is any valid expression.