关于while循环的问题 [英] question about while loop

查看:109
本文介绍了关于while循环的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

分号在while循环中的条件之后会发生什么?

what happens when semicolon comes after condition in while loop

推荐答案

循环(伪代码) )

In the while loop (pseudo code)
while (<CONDITION>);



在断言< CONDITION>时执行空语句。非零,例如




The empty statement is executed while the assertion <CONDITION> is non-zero, for instance

while (5);



是一个无限(空)循环。





另一方面,之后需要分号 > do-while 循环,关闭声明:


is an infinite (empty) loop.


On the other hand, a semicolon is required after the while in the do-while loop, to close the statement:

do
  c = getchar();
while ( c != EOF );


这篇关于关于while循环的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆