Golang基础之关键字
- 人工智能
- 2025-08-18 10:57:01

Type 参考 ## blog.csdn.net/SHELLCODE_8BIT/article/details/122837699
type有如下几种用法:
定义结构体定义接口类型定义类型别名类型查询 类型定义 type Celsius float64 // 摄氏温度 type Fahrenheit float64 // 华氏温度 const ( AbsoluteZeroC Celsius = -273.15 // 绝对零度 FreezingC Celsius = 0 // 结冰点温度 BoilingC Celsius = 100 // 沸水温度 ) // func CToF(c Celsius) Fahrenheit { return Fahrenheit(c*9/5 + 32) } func FToC(f Fahrenheit) Celsius { return Celsius((f - 32) * 5 / 9) }Golang基础之关键字由讯客互联人工智能栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“Golang基础之关键字”
上一篇
[JAVAee]MyBatis
下一篇
kafka消息队列简单使用