One line after another
Control flow is the order in which lines run. Inside main, statements run one at a time, from the top down. Line 3 runs first: int n = 3; makes a variable n that holds 3.
Line 4 starts a while loop. Before every pass it tests a condition, n > 0. A condition is either true or false. n is 3, and 3 > 0 is true, so the loop's body, the lines inside { }, runs.
Choosing a path
Line 5 asks another question: if (n == 1). Two equals signs mean 'is equal to'. 3 == 1 is false, so line 6 under the if is skipped. The program jumps to the else on line 7.
else means 'otherwise'. Its line runs only when the if's condition was false. Line 8 prints the value of n, so 3 appears in the terminal. Exactly one of the two paths runs, never both.
Line 9, n = n - 1;, reads n (3), subtracts 1 and stores the answer back in n. Now n holds 2. Without this line n would stay 3, and the loop would never stop.
Repeating
The closing } on line 10 sends the program back up to line 4 to test again. 2 > 0 is still true, so the body runs once more: 2 == 1 is false, line 8 prints 2, and n becomes 1.
Back at line 4: 1 > 0 is true, so a third pass starts. This time n == 1 is true too, so line 6 runs and prints last. Because the if path ran, the else path on lines 7 and 8 is skipped.
Line 9 makes n 0, and line 10 sends the program back to line 4. Now 0 > 0 is false, so the loop is over: the program jumps past the loop's closing } to line 11.
Line 11 prints Go!, and line 12 ends main: the program finishes. The output is 3, 2, last, Go!. The loop ran its body three times, and if and else picked one path on each pass.
What happens
;; step 1/9 · sequence main() runs its statements in order, top to bottom the arrow beside the card marks the line running now line 3 int n = 3; → n holds 3 control flow = the order the lines run in if and while change that order (next steps)
An if or else without braces controls only the one statement after it, as on lines 6 and 8. Many style guides suggest always writing braces { } so that adding a second line later cannot slip outside the if. Reaching the closing } of main without a return statement is the same as return 0;, so this program ends with exit status 0 (success). This rule applies only to main.