Go语言的单目加/减运算符

以下摘自The Go Programming Language

There are also unary addition and subtraction operators:
+ unary positive (no effect)
– unary negation
For integers, +x is a shorthand for 0+x and -x is a shorthand for 0-x; for floating-point and complex numbers, +x is just x and -x is the negation of x.

 

发表评论

邮箱地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.