在 Golang 中,可以使用 if 语句来判断 bool 类型。
示例代码:
package main
import "fmt"
func main() {
var b bool = true
if b {
fmt.Println("b is true")
} else {
fmt.Println("b is false")
}
}
输出结果为:
b is true
在 Golang 中,可以使用 if 语句来判断 bool 类型。
示例代码:
package main
import "fmt"
func main() {
var b bool = true
if b {
fmt.Println("b is true")
} else {
fmt.Println("b is false")
}
}
输出结果为:
b is true
本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=1797
还没有评论,快来说点什么吧~