Conditional

Contents

◷ Reading Time: 1 minute

iff

To be used to determine whether another expression is true or false. If the expression is true, it returns one value; if it is false, it returns another.

 iff (expression, then, else)
  • expression: Expression that returns a boolean value (Mandatory)
  • then: Value to assign if the expression returns true (Mandatory)
  • else: Value to assign if the expression returns false (Mandatory)
Example: iff (2 < 1, 5, 2)
Result: 2
Example: 
A := 5
iff (A == 5, 'A is 5', 'A is not 5')
Result: A is 5

case

Evaluates a list of conditions and returns one of the multiple possible result expressions. To provide multiple conditions must be used with iff.

|case is a monadic operator in which the input of the monad has no effect on the result

null |case (conditions, else)
  • conditions: list of conditions to be evaluated
  • else: if no conditions are met, it returns this value
Example: 
a := 5 
null|case  (iff(a==1, 'a is 1'), 
           iff(a==2, 'a is 2'),
           'a is something else') 

Result: a is something else 
Updated on January 12, 2021

Was this article helpful?

Related Articles