The "+ +" and "-" operators in the Go language

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

The following excerpt from the Go programming Language:

The increment statement i++ adds 1 to I; It ' s equivalent to i + = 1 which are in turn equivalent to i = i + 1. There ' s a corresponding decrement statement i–that subtracts 1. These was statements, not expressions as the Y was in the very languages in the C family, so j = i++ was illegal, and the Y are Postfix only, so–i are not legal either.

Note that, i++ and i-- in the Go language is a statement, not an expression, so you cannot assign a value to another variable. Furthermore there is no ++i and --i .

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.