Share this page

# Example: case

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.

        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 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: