πŸ’©

programierds

do-while / guided simulation

Do-while loop
step by step

Here you can clearly see what makes <code>do-while</code> special: it executes the block at least once and only then evaluates the condition.

1) Code and active line Active line: 1
1int i = 1;
2do {
3  printf("Vuelta %d\n", i);
4  i = i + 1;
5} while (i <= 4);
6printf("Fin do-while\n");
Step 1: Declares i with value 1.
Step 1 / 11
2) Internal state
Current i1
Iterations executed0
Condition i &lt;= 4-
3) Simulated console
./do-while-demostdout