【go语言 基础系列】关键字、内置数据及声明

【关键字】

if else for range select
switch case break continue

fallthrough

package import var type const
struct func interface map chan
default deffer go return got


【内置数据】

内置的常量

true false iota nil

内置的类型

int int8 int16 int32 int64  
uint uint8 uint16 uint32 uint64 uintptr
float32 float64 complex128 complex64    
bool byte rune string  error  

内置的函数

make len cap new append copy close delete
complex real imag          
panic recover            

【声明】

常用的有四类数据需要声明,分别是

变量    var

常量    const

类型    type

函数    func

有两点需要特别关注

1、其中首字母的大小写决定其可见性是否跨包

2、声明不区分顺序

猜你喜欢

转载自blog.csdn.net/natpan/article/details/83057881
今日推荐