Missing condition on assertion error in go lang
I have an if statement that is not evaluating correctly:
// 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
This error message -
missing condition in if statement
I've already put conditions in brackets, etc.
+3
source to share
2 answers
You will need to put {
at the end if
:
if h != 2 && h != 3 && h != 5 && h != 6 && h != 7 && h != 8 {
fmt.Println("Hello")
}
return 0
See this example .
Cm. Also, " Why Golang forces braces not be on the next line? ".
+10
source to share