Getting Started with C # basics (arithmetic operator + +-)

Source: Internet
Author: User

The operator is the symbol used for the operation, acting on one or more operands. (operand: The data that participates in the operation. )

operator + + and--

+ +, called the self-add operator . For example, number 22nd today, a day next year, written in code is this:

int number=22;//today No. 22nd
number=number+1;//tomorrow, in today's days on +1;

number++; Number=number+1; The function is the same, the value of the variable is +1.

--called the self-decrement operator . Today, for example, number 22nd, yesterday, a day less, written in code is this:

int number=22;//today number 22nd number--;//equals to number=number-1;

Other than that

number++; with number--; can also write + +
number; or--number;

Variable name + +
Calculates the same return result as a variable
Increment the value of a variable by 1

+ + variable Name
The result returned by the calculation is a variable self-increment of 1
Increment the value of a variable by 1
--Variable name
The result returned by the calculation is a variable self minus 1
subtract 1 from a variable's value
Variable name--
The calculation returns the same result as the variable
subtract 1 from a variable's value

Getting Started with C # basics (arithmetic operator + +-)

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.