From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
A trinary operator that evaluates an expression and returns results when it is True or False.
If(condition, <result when expression is true>, <result when expression is false>)
|condition||Required. A boolean, numeric, or string expression that evaluates to True or False.|
|result when expression is true||Required. This result is returned when the expression evaluates to True.|
|result when expression is false||Required. This result is returned when the expression evaluates to False.|
The return type is the common type between the two result values. For example, if an Int8 and an Int32 are used as result values, the result type will actually be Int32. Having no common type results in a Type Mismatch compile error.
This operator uses the same evaluation rules as a normal If...Then...Else statement. Only the result that is needed gets evaluated.
This code outputs "Big number":