IF()


Return the result of an expression based on a condition.

Syntax

IF(<lCondition>, <exp1>, <exp2>) --> Value

Arguments

<lCondition> --> is a logical expression to be evaluated.

<exp1> --> is the value, an expression, of any data type, which is returned if <lCondition> is true (TRUE).

<exp2> --> is the value, an expression, of any date type, returned if <lCondition> is false (FALSE).

Returns

IF() returns the evaluation of <exp1> if <lCondition> evaluates to true (TRUE) and <exp2> if it evaluates to false (FALSE). The value returned is the data type of the valid condition-expression.

Description

This function accepts three parameters, the first is a condition, the second the value to be returned if the condition is true, and the third the value to be returned if the condition is false.

Examples

lIsJohn := TRUE

IF(lIsJohn, 'This is John', 'This is George')

* Result: Returns 'This is John' as lIsJohn = TRUE. Otherwise

* would have returned 'This is George'

The If() function can be used as short-hand for a set of statements such as:

If Number == 10

   Return TRUE

Else

   Return FALSE

Endif

Using If() this could be written as:

IF(Number == 10, TRUE, FALSE)

____________________________

Related Topics:

Business Function List



CAPITAL VISUAL BUILDER