06
Control flow
Make decisions and repeat work.
So far, each program has run straight from the first line to the last. Real programs need to choose ("if the score is 40 or more, print pass") and to repeat ("print the numbers 1 to 100"). The order in which statements run is called control flow.
စံကား
Expected output
အောင်
၁
၂
၃
In this chapter
| Page | Does |
|---|---|
| If and else | run statements when a condition is true |
| While loops | repeat while a condition holds |
| Counted loops | repeat once for each number in a range |
| Generic loops | a loop with its own counter, test and update |
| Break and continue | leave a loop at once, or skip to its next round |
Each of these runs an inner part: either one statement or
a block (အောက်ပါတို့ကို လုပ်ဆောင်ပါ။ ... လုပ်ဆောင်စရာများ ပြီးပါပြီး။).
Next: If and else.