C-Programmierung
Kontrollstruktur Do-While Flussdiagramm
← Kontrollstruktur Do-While | ● | Kontrollstruktur Do-While Beispiele →
Do-While Flussdiagramm
-------------> ...
|
n
|
-------> statements -----> condition? ---y---
^ |
| |
| |
--------------------------------
Beispiele:
int a=1,b=3;
do
b--; /* 2 times */
while (a<b);
do
b--; /* 2 times */
while (a<b);
int a=1,b=1;
do
b--; /* 1 time */
while (a<b);
do
b--; /* 1 time */
while (a<b);
Fallgrube: while (…); sieht aus wie eine neu beginnende while-Schleife.
Empfehlung: Generell nach Schleifen oder logischen Blöcken eine Leerzeile einfügen.
Übersicht der Kontrollstrukturen
← Kontrollstruktur Do-While | ● | Kontrollstruktur Do-While Beispiele →