How to Transaction Rollback in Apex - Code Snippet

How to perform 'Transaction Rollback' in Apex.

example.cls
// Task: Transaction Rollback
// Language: Apex

public void transaction_rollback() {
    // Implementation for Transaction Rollback
    Object result = ...; // Initialize variable
    // TODO: Implement core logic here
    // Step 1: Prepare data
    // Step 2: Process Transaction Rollback
    System.debug("Done");
}
AdSense Slot