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.
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).

