IF Examples
-
An example using the
IFstatement.Assume that the variablesFIRST,LINE2andLASTwere declared earlier.... IF (FIRST IS NOT NULL) THEN LINE2 = FIRST || ' ' || LAST; ELSE LINE2 = LAST; ... -
Given
IF … THEN … ELSEis a statement, it is possible to chain them together.Assume that theINT_VALUEandSTRING_VALUEvariables were declared earlier.IF (INT_VALUE = 1) THEN STRING_VALUE = 'one'; ELSE IF (INT_VALUE = 2) THEN STRING_VALUE = 'two'; ELSE IF (INT_VALUE = 3) THEN STRING_VALUE = 'three'; ELSE STRING_VALUE = 'too much';This specific example can be replaced with a simple
CASEor theDECODEfunction.