Inline if


any iif(x a b)



x - any expression that is either true (not 0) or false (0).

a, b - expressions of any type. Can be numeric or string values, variables, functions, expressions with operators.



Selects one of two expressions. If x is true (not 0), returns a, else returns b.


Does not evaluate the other expression. For example, if a and b are functions, calls only one of them.


Expressions a and b must have same or similar types. If one is pointer or string, other can be 0. The return type depends on types of a and b. If both are pointers of different types, the return type is type of b.


See also: Operators if



 if i<10 then j=i, else j=10
j=iif(i<10 i 10)