Blogger Information
Blog 70
fans 4
comment 5
visits 104844
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Go:变量声明,字符类型
JiaJieChen
Original
1044 people have browsed it

一.变量的字符类型

常用的基本类型 说明
bool 布尔值
int 整型
folat 浮点型
字符串

二.变量的声明

大家可以看到变量声明和php大不一样,go语言变量声明用的是var声明变量,而PHP用的是$符号声明变量,然后在go语言单中声明了变量必须要使用,不使用会抛出异常错误,在声明变量之后可以进行对变量声明type状态,如果不声明状态则默认为以下

可以看见,整型默认值为int,folat默认值为folat64,这里需要注意一下,folat有两个状态,一个是32,一个是64,推荐使用64,因为32会丢失精确度
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post