If

Function

If(condition, ifTrue, ifFalse)

condition
ifTrue
ifFalse

If is included by default in each file as part of the Logic library.

 

See also:


Use

The If() function returns one value if the given condition is true, and another value if the condition is false. It basically works like the If() function in conventional spreadsheets.

The "math display" of an If() function is a logic table.

You can chain If() functions together by putting another If() function in the "false result" input. When this is done, the logic table is extended.

Examples
  • If(A > 100lb, "overload", "OK")  = "overload" for A = 120lb
  • If(B > 20ft, 20ft, B + (20ft - B)/2)  = 18ft for B = 16ft
  • If(C == "X", 5ft, If(C == "Y", 10ft, "input error"))  = 10ft for C = "Y"