x, y are arbitrary numbers,
arrays, or strings, or functions that evaluate to one of these.
Notes:
Only necessary arguments of if are evaluated. If cond is true, y is not evaluated, and if cond is false, x is not evaluated. Errors in x and y may go undetected this way.
if is a Mathcad control operator, not a function, and does not work with operators that modify functions, like the vectorize operator. To do repeated tests, use until.
When using until to return a vector, the vector should be initialized beforehand, such as by typing v[0:0. This ensures that if the initial evaluation is negative, until returns a reasonable result.
The impulse and step functions are special instances of the if function.
If the value of icond never becomes negative, until performs an infinite loop. Press [Esc] to interrupt calculations. If multiple range variables are used in icond, iteration proceeds over all range variables until the first timeicond is negative.