1 Star 0 Fork 0

c01dface/s-go-example

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
if-else.go 685 Bytes
一键复制 编辑 原始数据 按行查看 历史
c01dface 提交于 2024-11-04 18:55 . add if-else.go
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")
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/vmalloc/s-go-example.git
git@gitee.com:vmalloc/s-go-example.git
vmalloc
s-go-example
s-go-example
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385