在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
概述 string
bool
int8 uint8 int16 uint16 int32 uint32 int64 uint64
float32 float64
//demo_1.go package main import ( "fmt" ) func main() { const name string = "Tom" fmt.Println(name) const age = 30 fmt.Println(age) const name_1, name_2 string = "Tom", "Jay" fmt.Println(name_1, name_2) const name_3, age_1 = "Tom", 30 fmt.Println(name_3, age_1) }
//demo_2.go package main import ( "fmt" ) func main() { var age_1 uint8 = 31 var age_2 = 32 age_3 := 33 fmt.Println(age_1, age_2, age_3) var age_4, age_5, age_6 int = 31, 32, 33 fmt.Println(age_4, age_5, age_6) var name_1, age_7 = "Tom", 30 fmt.Println(name_1, age_7) name_2, is_boy, height := "Jay", true, 180.66 fmt.Println(name_2, is_boy, height) }
//demo_3.go package main import ( "fmt" ) func main() { fmt.Print("输出到控制台不换行") fmt.Println("---") fmt.Println("输出到控制台并换行") fmt.Printf("name=%s,age=%d\n", "Tom", 30) fmt.Printf("name=%s,age=%d,height=%v\n", "Tom", 30, fmt.Sprintf("%.2f", 180.567)) }
|
请发表评论