当前位置:网站首页>Go学习笔记1.3-变量的数据类型篇
Go学习笔记1.3-变量的数据类型篇
2022-06-26 06:13:00 【是誰萆微了承諾】
变量的数据类型
一、 基本数据类型
1.数值型
1.1整数类型
int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 byte
1.2 浮点型
folat32 folat64
1.3 字符型(没有专门的字符类型,通常使用byte来保存单个字母和字符)
1.4 布尔型 true fasle
1.5 字符串型(string)
2.派生|复杂的数据类型
2.1 指针(pointer)
2.2 数组
2.3 结构体(struct)
2.4 管道(channel)
2.5 函数
2.6切片(slice)
2.7接口(interface)
2.8 map
二、数据类型的详解
1.1 整数类型
int8: 有符号 8位整型 (-128 到 127)
int16: 有符号 16位整型 (-32768 到 32767)
int32: 有符号 32位整型 (-2147483648 到 2147483647)
int64: 有符号 64位整型 (-9223372036854775808 到 9223372036854775807)
uint8: 无符号 8位整型 (0 到 255)
uint16: 无符号 16位整型 (0 到 65535)
uint32: 无符号 32位整型 (0 到 4294967295)
uint64: 无符号 64位整型 (0 到 18446744073709551615)
byte: uint8的类型别名 无符号 8位整型 (0 到 255)
1.2浮点型(它们的算术规范由IEEE754浮点数国际标准定义,该浮点数规范被所有现代的CPU支持)
float32: IEEE-754 32位浮点型数
float64: IEEE-754 64位浮点型数
1.3字符串类型
字符串是一个不可改变的字节序列,字符串的元素不可修改(元素不可更改,字符串变量可以重新赋值),是一个只 读的字节数组。所以字符串的长度是固定的,但是跟数组不一样,字符串长度不是字符串类型的一部分。
1.4布尔型 true fasle
2.复杂类型
.....后续补充
三、转义字符
\b 退格
\f 换页
\n 换行
\r 回车
\t 制表符
\v 垂直制表符
\' 单引号 (只用在 '\'' 形式的rune符号面值中)
\" 双引号 (只用在 "..." 形式的字符串面值中)
\\ 反斜杠
边栏推荐
- TCP連接與斷開,狀態遷移圖詳解
- Data visualization practice: Data Visualization
- Thread status and stop
- 04. basic data type - list, tuple
- Pytorch mixing accuracy principle and how to start this method
- How can an enterprise successfully complete cloud migration?
- Underlying principle of MySQL index
- SQL server functions
- Thinking and summary of technical ability
- 事务与消息语义
猜你喜欢

How to design a good technical scheme

数据可视化实战:实验报告
How can an enterprise successfully complete cloud migration?

Thinking and summary of technical ability

跨域的五种解决方案

Import / export function implementation

低代码实时数仓构建系统的设计与实践

连接数服务器数据库报:错误号码2003Can‘t connect to MySQL server on ‘服务器地址‘(10061)

Zotero文献管理工具之Jasminum(茉莉花)插件

100 cases of go language
随机推荐
Pychart cannot run designer Exe (this application failed to start because no Qt platform plugin could be I appears)
Introduction to canal deployment, principle and use
事务与消息语义
Message queue - function, performance, operation and maintenance comparison
Spark source code analysis (I): RDD collection data - partition data allocation
Cython入门
05. basic data type - Dict
Dpdk - tcp/udp protocol stack server implementation (II)
Efk Upgrade to clickhouse log Storage Reality
Redis多线程与ACL
Gof23 - builder mode
numpy. log
在web页面播放rtsp流视频(webrtc)
温度报警器
A tragedy triggered by "yyyy MM DD" and vigilance before New Year's Day~
Everything is a vector. The service practice of iqiyi online vector recall project
MySQL-09
numpy.random.choice
302. 包含全部黑色像素的最小矩形 BFS
PyTorch混合精度原理及如何开启该方法