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 Name | Value Type | Variable Type | ||
---|---|---|---|---|
Condition: | cond | bool | boolean | |
Consequent: | x | real, complex | boolean, scalar, vector, matrix, signal, xy-data | |
Alternative: | y | real, complex | boolean, scalar, vector, matrix, signal, xy-data | |
Result: | real, complex | boolean, scalar, vector, matrix, signal, xy-data |
Calculator Input
Use the
, , and buttons to complete the operation.Example
ID | Description | Type | Value | Expression | |
---|---|---|---|---|---|
x | Argument | REAL | 2 | 2 | |
r1 | Argument | REAL | 0 | 0 | |
r2 | Argument | REAL | 5 | 5 | |
c1 | Result | REAL | 0 | #IF x <= 2 #THEN r1 #ELSE r2 | |
c2 | Result | REAL | 5 | #IF x < 2: r1 #ELSE r2 |