代码是“while(condition);"吗?有效是什么意思? [英] Is the code "while(condition);" valid and what does it mean?

查看:25
本文介绍了代码是“while(condition);"吗?有效是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在 C 编程中使用像 while(condition); 这样的分号吗?如果 while(condition); 是有效的,那是什么意思?

Can we put semicolon like while(condition); in a C Programming? If while(condition); is valid, what does it mean?

推荐答案

while (condition);

while (condition) 
{
}

它可以用于等待循环,例如:

It can be used for waiting loops, e.g.:

while (!isLightGreen()); // waits until isLightGreen() returns true
go();

这篇关于代码是“while(condition);"吗?有效是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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