Share this page

# case

Used within a switch statement to control conditional operations. Control passes to the operation whose case statement matches the value of switch(expression).

## Example

The following example contains a switch and case statement that tests values of rc. If rc's value is 1, then the transaction is deemed a success.

Copy code

        int rc;
    // Server API call
        lr_start_transaction ("deposit");
        rc = 1; // Place your own call here e.g., rc = bank_deposit (50);
        switch(rc) {
            case 1: lr_end_transaction ("deposit", LR_PASS);
            break;
            case 0: lr_end_transaction ("deposit", LR_PASS);
            break;
            case -1: lr_end_transaction ("deposit", LR_FAIL);
            break;
        }

    Example: Output:
    Action.c(5): Notify Transaction deposit started.
    Action.c(12): Notify Transaction deposit ended with Pass status (Duration: 0.0200).

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