While and do-while
A while loop evaluates the condition before the loop:
1. while (!isDone()) {
2. doSomething();
3. }
A do-while loop evaluates the condition after the loop:
1. do {
2. printLine();
3. } while (!atEndOfPage());
A while loop evaluates the condition before the loop:
1. while (!isDone()) {
2. doSomething();
3. }
A do-while loop evaluates the condition after the loop:
1. do {
2. printLine();
3. } while (!atEndOfPage());
本文档使用 WanXiangYunDang 构建