Go 关键字

1, const 关键字用来定义常量      const name type = value  (不论全局还是局部,必须要赋值)

       var 在函数体外用来全局变量的声明和赋值    var name type = value(值可省)

       type 用来接口和结构的声明   type name struct{}   type name interface{}
       func 用来函数的声明        

2,通过大小写来决定 变量, 常量,接口·,结构,函数是否可以被外部包所引用

func Printf(){

}

大写:public   小写·: private

猜你喜欢

转载自blog.csdn.net/weixin_42720316/article/details/89134567
今日推荐