mirror of
https://gitee.com/shikong-sk/golang-study
synced 2025-02-23 15:32:15 +08:00
14 lines
249 B
Go
14 lines
249 B
Go
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func main() {
|
||
|
// 在 golang 中 不允许 从其他类型 强制转换 到 bool 类型
|
||
|
b1 := true
|
||
|
// bool 默认为 false
|
||
|
var b2 bool
|
||
|
|
||
|
// %T 打印变量类型
|
||
|
fmt.Printf("b1: %T %t\nb2: %T %t\n", b1, b1, b2, b2)
|
||
|
}
|