Go语言学习之运算符(The way to go)
2017-02-25 00:18
676 查看
生命不止,继续go go go
今天介绍go中的运算符。
运算符大概分为:
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operators
Assignment Operators
Misc Operators
这里没有什么好说的。唯一需要注意的就是自增和自减:
go中没有前缀自增和前缀自减:
最后需要注意:
:=不是运算符
一定要区分 ||和|,区分&&和&
今天介绍go中的运算符。
运算符大概分为:
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operators
Assignment Operators
Misc Operators
Arithmetic Operators
这里没有什么好说的。唯一需要注意的就是自增和自减:
go中没有前缀自增和前缀自减:
//syntax error: unexpected ++, expecting a := 1 ++a
Relational Operators
Logical Operators
A为1,B为0Bitwise Operators
Assignment Operators
Misc Operators
最后需要注意:
:=不是运算符
一定要区分 ||和|,区分&&和&
相关文章推荐
- Go语言学习之运算符(The way to go)
- Go语言学习之flag包(The way to go)
- Go语言学习之archive/zip、compress/zlib、compress/gzip包(the way to go)
- Go语言学习之encoding/json包(The way to go)
- Go语言学习之指针(The way to go)
- Go语言学习之errors包(The way to go)
- Go语言学习之interface(The way to go)
- Go语言学习之ioutil包(The way to go)
- Go语言学习之字符串(The way to go)
- Go语言学习之bufio包(The way to go)
- Go语言学习之time包(获取当前时间戳等)(the way to go)
- Go语言学习之encoding/gob包(The way to go)
- Go语言学习之变量(The way to go)
- Go语言学习之struct(The way to go)
- Go语言学习之runtime包(The way to go)
- Go语言学习之Hello World(The way to go)
- Go语言学习之常量(The way to go)
- Go语言学习之image、image/color、image/png、image/jpeg包(the way to go)
- Go语言学习之net/http包(The way to go)
- Go语言学习之map (The way to go)