If Statement

An If-statement on buttons [IF], [THEN], [ELSE] has to be conform to one of the following syntaxes.

  • #IF condition: consequent #ELSE alternative

  • #IF condition #THEN consequent #ELSE alternative

Syntax

#IF condition #THEN consequent #ELSE alternative

Types
 Variable NameValue TypeVariable Type
Condition:condboolboolean
Consequent:xreal, complexboolean, scalar, vector, matrix, signal, xy-data
Alternative:yreal, complexboolean, scalar, vector, matrix, signal, xy-data
Result:  real, complex boolean, scalar, vector, matrix, signal, xy-data
Calculator Input

Use the IF, THEN, and ELSE buttons to complete the operation.

Example
IDDescriptionTypeValueExpression
xArgumentREAL22
r1ArgumentREAL00
r2ArgumentREAL55
c1 Result REAL 0#IF x <= 2 #THEN r1 #ELSE r2
c2 Result REAL 5#IF x < 2: r1 #ELSE r2