Description: Returns expression_true if test_expression is TRUE, or expression_false otherwise.
expression_test is interpreted as an integer. IF() returns a datatype according to the following:
If expression_true or expression_false returns a string, the result will be a string.
If expression_true or expression_false returns a floating-point number, the result will be a floating-point number.
If expression_true or expression_false returns an integer, the result will be an integer.
Examples:
IF(5>3,'more','not more'), returns more.
IF(2>3,'more',0) returns 0 (as a string).
IF(2>3,1,0) returns 0 (as a numeric).
Note that
IF(0.2,'nonzero','zero') returns zero (because 0.2 is converted to an integer, becoming 0).
IF(0.2<>0,'nonzero','zero') returns nonzero (because 0.2 is compared with zero as a floating-point number, before the result is converted to an integer).
See also: CASE()
18.117.103.28