我的 if 语句未正确评估:
// Take advantage of Boolean short-circuit evaluation
if h != 2 && h != 3 && h != 5 && h != 6 && h != 7 && h != 8
{
fmt.Println("Hello")
}
return 0
这是错误信息-
missing condition in if statement
我已经试过把条件放在括号里等等
最佳答案
您需要将 {
放在 if
的末尾:
if h != 2 && h != 3 && h != 5 && h != 6 && h != 7 && h != 8 {
fmt.Println("Hello")
}
return 0
参见 this example .
另请参见“Why does Golang enforce curly bracket to not be on the next line?”。
关于go - go lang中if语句错误中缺少条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27190490/