Commit ecfef82
committed
feat: Demonstrate control flow variations using while, do-while, infinite loop, and if-else
🧠 Logic:
- Example 1 (commented): `while` loop that never executes since initial condition `i < 100` is false.
- Example 2 (commented): `do-while` loop that executes once even though `i < 100` is false initially.
- Example 3 (commented): `while(true)` loop using `byte` type which overflows after 127, causing infinite printing.
- Example 4 (active): `if(true)` block runs unconditionally, prints current `i`, increments it, and skips the `else`.
Signed-off-by: Somesh diwan <[email protected]>1 parent 413acc9 commit ecfef82
1 file changed
+19
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | | - | |
12 | | - | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | | - | |
| 18 | + | |
15 | 19 | | |
16 | | - | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | | - | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | | - | |
26 | | - | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
0 commit comments