Evaluates a conditional expression. If the conditional expression is TRUE
IF(cond, trueExpr, falseExpr)
cond |
- |
Any expression resolving to a number. |
trueExpr |
- |
Expression to evaluate if condition is TRUE |
falseExpr |
- |
Optional. Expression to evaluate if condition is FALSE (zero) |
SPL compound syntax:
if (expr) statements
if (expr) statements1 else statements2
expr |
- |
Any expression resolving to a number. |
statements |
- |
One or more valid expressions separated by semicolons. |
The result of evaluating trueExpr or falseExpr.
Functional form. If the maximum value of W1 is greater than the maximum value of W2, then generate a sine wave in the current Window. If not, generate a random series in the current Window.
SPL form. Operates the same as above.
The compound IF-ELSE statement applies to SPL files.
Versions of DADiSP prior to 3.0 required quotes around trueExpr and falseExpr. For the sake of backward compatibility, DADiSP accepts the true and false expressions with or without quotes. However, if possible, do not include quotes around these expressions as future versions of DADiSP may not support this syntax.
The C/C++ style ternary conditional statement is also supported. For example, the statement:
is equivalent to:
See SWITCH to transfer control to one of several statements based on a number or string.