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 2
                                   // adds 3
                                   // stops and returns 5
    else
        return mystery(b - 1) + 2; // call 2
}

Call stack

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

Forward to Step 10
Back to Step 8
Back to main example