default

Provides a default value for an expression in a switch statement, if the variable being evaluated is not equal to any of the cases.

Example

In the following example, control passes to the default statement because the variable menu, whose value is 4, does not appear in any specific case statement.

    int menu = 4;
    switch(menu) {
    case 1: 
        lr_output_message ("Option 1");
        break;
    case 2:
        lr_output_message ("Option 2");
        break;
    case 3:
        lr_output_message ("Option 3");
        break;
    default:
        lr_output_message ("Invalid option selected\n");
}
Example: Output:
Action.c(16): Invalid option selected