1 Star 0 Fork 1.5K

沐瑶 / LearningNotes

forked from 陌溪 / LearningNotes 
Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
README.md 438 Bytes
Copy Edit Web IDE Raw Blame History
陌溪 authored 2020-08-06 08:34 . update Golang README.md

Go的运算符

算数运算符

  • +:相加
  • -:相减
  • *:相乘
  • /:相除
  • %:求余

在golang中, ++ 和 -- 只能单独使用,错误的写法如下

var i int = 8
var a int
a = i++  // 错误,i++只能单独使用
a = i--  // 错误,i--只能单独使用

同时在golang中,没有 ++i这样的操作

var i int = 1
++i  // 错误

正确的写法

var i int = 1
i++ //正确

Comment ( 0 )

Sign in for post a comment

1
https://gitee.com/muyao_vip/LearningNotes.git
git@gitee.com:muyao_vip/LearningNotes.git
muyao_vip
LearningNotes
LearningNotes
master

Search

102255 3a0e046c 1850385 102255 7aaa926c 1850385