25

go语言基础语法-清风

 4 years ago
source link: https://blog.51cto.com/qingfeng00/2463939
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
go语言基础语法定义变量在go语言中有两种定义变量的方法:var的方式,如下vara=1将a变量赋值1第二种方式":=",如下:a:=1和上述一样,将a变量赋值1注:变量名:=变量值,这种方式只适用于第一次赋值变量时,如果变量已赋值,如上的a已经赋值为1,此时如果想重新赋值在使用a:=2这种方式会报错,更改赋值直接a=2即可定义函数:在go语言中没有class关键字,没有类的概

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK