Conditional (if and otherwise) Operators

if

Keystroke: } Do not type the word "if." It does not produce the operator.

x  if  y

Evaluates x if y is nonzero (true). The enclosing program proceeds to the next line regardless of whether x is evaluated or not. Conditional statements allow Mathcad to execute or skip certain calculations. Use a conditional statement whenever you want to direct program execution along a particular branch.

otherwise

Keystroke: [Ctrl] [Shift] ] Do not type the word "otherwise." It does not produce the operator.

x otherwise

Evaluates x if the if statement immediately preceding x is 0 (false). The otherwise operator only works with the if operator. In the following example,

otherwise operator

the function returns 0 if x is greater than 2 or less than −2. When x is between −2 and 2, the function returns the square root of 4 − x2.

Operands:

Notes:

QuickSheet

Related Topics