本文共 1088 字,大约阅读时间需要 3 分钟。
Here you will get to know about difference between while and do while loop.
在这里,您将了解while和while循环之间的区别。
Both while and do while loops are used to execute set of statements multiple times. But there are some differences between them in terms of syntax and working that I have discussed below.
while和do while循环都用于多次执行语句集。 但是它们之间在语法和工作方式方面存在一些差异,我下面将进行讨论。
while(condition){ loop body;}
do{ loop body;}while(condition);
while loop | do while loop |
It is entry controlled loop. That means condition is checked at the start of loop body. | It is exit controlled loop. That means condition is checked at the end of loop body. |
Loop body is not executed if condition is false. | Loop body is executed once even if condition is false. |
Generally not used for making menu driven programs. | Generally used for making menu driven programs. |
while循环 | 做while循环 |
它是入口控制的循环。 这意味着在循环体开始时检查条件。 | 这是退出控制循环。 这意味着在循环体的末端检查条件。 |
如果条件为假,则不执行循环体。 | 即使条件为假,循环体也会执行一次。 |
通常不用于制作菜单驱动程序。 | 通常用于制作菜单驱动程序。 |
翻译自:
转载地址:http://ioggb.baihongyu.com/