iif#

swordfish.function.iif()#

Performs an element-wise conditional operation, evaluating each element of the condition. Specifically, if cond[i] is true, it returns the i-th element of trueResult; otherwise, it returns the i-th element of falseResult. When cond[i] is a null value, it returns a null value.

Note

This function first parses the arguments and then returns trueResult or falseResult based on the result of cond.

Parameters:
  • cond (Constant) – A Boolean scalar/vector/matrix. It can be an expression returning Boolean values.

  • trueResult (Constant) – A scalar/vector/tuple/matrix.

  • falseResult (Constant) – A scalar/vector/tuple/matrix. trueResult and falseResult have the same number of elements as cond. Both must have the same data type.