Share this page

# 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

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: