代码拉取完成,页面将自动刷新
package main
import "fmt"
func main() {
if 7%2 == 0 {
fmt.Println("7 is even")
} else {
fmt.Println("7 is odd")
}
// you can have an if statement without an else
if 8%4 == 0 {
fmt.Println("8 is divisible by 4")
}
// Logical operators like && and || are often useful in conditions
if 8%2 == 0 || 7%2 == 0 {
fmt.Println("either 8 or 7 are even")
}
// A statement can precede conditionals; any variables declared in
// this statement are available in the current and all subsequent branches
if num := 9; num < 0 {
fmt.Println(num, "is negative")
} else if num < 10 {
fmt.Println(num, "has 1 digit")
} else {
fmt.Println(num, "has multiple digiits")
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。