public int mystery(int b)
{
    if (b == 0)
        return 0;
    
    if (b % 2 == 0)
        return mystery(b - 1) + 3; // call 1
                                   // finished call 1, got back 7
                                   // adds 3
                                   // stops and returns 10
    else
        return mystery(b - 1) + 2; // call 2
}

Call stack

m(0)   returns 0
m(1)   returns 2
m(2)   returns 5
m(3)   returns 7
m(4)   returns 10
m(5)2

Forward to Step 12
Back to Step 10
Back to main example