else

Provides an alternate statement for an if condition. In an if statement, if the expression is true, then if's statement is executed. If an else clause is given and if the expression is false, then the else's statement is executed.

Copy code
if( <i>expression</i> ) <i>statement1</i>;
else <i>statement2</i>;

Example

The following example tests whether characters with the ascii values 107 and 22 are alpha-numeric. If not, the else clause prints a suitable message.

Copy code
    if (isalpha(107))
        lr_output_message ("The value 107 is %c", 107);
    else
        lr_output_message ("The value 107 is non-alphabetic");
    if (isalpha(22))
        lr_output_message ("The value 22 is %c", 22);
    else
        lr_output_message ("The value 22 is non-alphabetic");
Example: Output: 
Action.c(4): The value 107 is k
Action.c(11): The value 22 is non-alphabetic