主页
Go
Go else 语句
demo_if_else3
运行 ❯
×
更改方向
保存代码
更改主题
package main import ("fmt") func main() { temperature := 14 if (temperature > 15) { fmt.Println("外面很暖和。") } // 这会引发错误 else { fmt.Println("外面很冷。") } }
./prog.go:9:3:语法错误:意外的 else,应为 }