Precedence of the vb.net operator

Source: Internet
Author: User
Tags arithmetic arithmetic operators comparison expression integer division logical operators

When you operate in each expression, each part of the operation is evaluated in a certain order, which is the order of precedence of the operation, also called the precedence of the operator.

In an expression, if there is more than one operator, the arithmetic operator is processed first, then the comparison operator, and finally the logical operator. In the same operator, the monocular operator has precedence over the binocular operator. Operators with the same precedence, treated in left-to-right order (except for operations).

The string concatenation operator (&) is not an operator, but for its precedence, it is ranked after all arithmetic operators, and before all comparison operators.

You can also use parentheses to change the finite order, forcing certain parts of the command expression to execute preferentially. The symbols inside the parentheses have precedence over the operators outside the parentheses, and the operator precedence in the same bracket does not change, using parentheses eliminates the hassle of rote operator precedence and facilitates readability and maintainability of the program.

The following table is the precedence order for each operator.

Arithmetic, binary, and connection operators Comparison operators logical operators
Find the sign (^) Equal sign (=) Not
Minus SIGN (-) Unequal number (<>) and
Division Number (*,/) Less Than (<) Or
Integer division number (\) Greater than (>) Xor
Claim number (MOD) Less than or equal to (<=)
Plus minus sign (+,-) Greater than or equal to (>=)
Binary operator (BITNOT,BITAND,BITOR,BITXOR) Like,is
Connection operators (&)

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.