我有這個(gè) if 語(yǔ)句沒有正確評(píng)估:// Take advantage of Boolean short-circuit evaluationif h != 2 && h != 3 && h != 5 && h != 6 && h != 7 && h != 8{ fmt.Println("Hello")}return 0這是錯(cuò)誤信息 -missing condition in if statement我已經(jīng)嘗試將條件放在括號(hào)等中。
2 回答

MYYA
TA貢獻(xiàn)1868條經(jīng)驗(yàn) 獲得超4個(gè)贊
您需要將 放在{的末尾if:
if h != 2 && h != 3 && h != 5 && h != 6 && h != 7 && h != 8 {
fmt.Println("Hello")
}
return 0

滄海一幻覺
TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超5個(gè)贊
您必須像這樣在 if 條件之后立即放置 Curly Braches:
正確的例子
if(condition){
<code comes here>
}
錯(cuò)誤的例子
if(condition)
{
<code comes here>
}
- 2 回答
- 0 關(guān)注
- 213 瀏覽
添加回答
舉報(bào)
0/150
提交
取消