W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
只要給定條件為真,D編程語言中的while循環(huán)語句就會(huì)重復(fù)執(zhí)行目標(biāo)語句。
D編程語言中while循環(huán)語法為-
while(condition) {
statement(s);
}
import std.stdio;
int main () {
/* local variable definition */
int a=10;
/* while loop execution */
while( a < 20 ) {
writefln("value of a: %d", a);
a++;
}
return 0;
}
編譯并執(zhí)行上述代碼時(shí),將生成以下結(jié)果-
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
value of a: 19
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: