while语句
C# 循环语句:while循环#上位机 #编程 #代码
while语句简单例子
1 “While” 作连词时,可以表示 “在…的时候,与…同时”。注意,“while” 可以放在句首使用,也可以在句中使用,但后者的句子中不使用逗号。
While we were sleeping, it snowed!
It snowed while we were sleeping!
While he was cooking, a parcel arrived.
A parcel arrived while he was cooking.
2 “While” 作连词时,可以表示 “但是,然而”。
One of the twins is shy, while the other is outgoing.
It took me an hour to solve this maths problem, while it took her only five minutes!
3 “While” 和 “whilst” 作连词时,可以表示 “虽然,尽管”,这是一个相对正式的用法,相当于 “although”。
While I know that sugar is bad for me, I can never say no to dessert!
While I understand that is your opinion, I'm afraid I do not agree.
4 “While” 作名词时,指 “一会儿,一段时间”。
It's been a while since we talked.
Are you looking for Jessica? I saw her a short while ago.
5 表达 “worth your while” 的意思是 “值得你下功夫去做,对你有帮助”。
Even though we only had a short while together, we hope this lesson was worth your while
Check out this article about how to keep a healthy diet – I promise it will be worth your while.
while语句的用法c语言
c语言中while的用法:
当n==1时执行while循环结构里的语句,当n不等于1时,则跳过该循环执行循环体外的语句。
while 循环的格式:while (表达式){语句;}
while 循环的执行顺序:当表达式为真,则执行下面的语句,语句执行完之后再判断表达式是否为真,如果为真,再次执行下面的语句,然后再判断表达式是否为真……就这样一直循环下去,直到表达式为假,跳出循环。