C語言有if - then嗎

來源:魅力女性吧 1.88W
C語言有if then嗎

C語言沒有if then。是因為then不是C語言關鍵字。一些語言中需要then來標定條件的結束,但是C語言的if語句是放在括號裏的,不需要這個then來標識條件的結束,所以就沒有了。

比如

if $a==3 then

$a = $a+1

這個then的作用是説明,條件到這裏就結束了

而在C中

if (a == 3) //這裏有括號,不需要then這種標識

a = a + 1

熱門標籤