VBS TUTORIAL: operator-Operator Precedence _vbs

Source: Internet
Author: User
Tags arithmetic arithmetic operators logical operators

Operator Precedence

When multiple operations are performed in an expression, each part is computed in a predetermined order called operator precedence. Parentheses can change the order of precedence, forcing a portion of the expression to be treated preferentially. The operations in parentheses are always executed before the outside brackets. However, in parentheses, the operator precedence remains normal.

When an expression has multiple operators, the arithmetic operator is processed first, then the comparison operator is processed, and then the logical operator is processed. All comparison operators have the same precedence, that is, they are processed from left to right in the order in which they appear. Arithmetic and logical operators are processed at the following priority levels:

arithmetic Compare logical
Exponential operation (^) Equal (=) Not
Negative number (-) Unequal (<>) and
Multiplication and division (*, /) Less than (<) Or
Divisible (\) Greater than (>) Xor
Remainder operation (Mod) Less than or equal to (<=) Eqv
Addition and subtraction (+, -) Greater than or equal to (>=) Imp
string concatenation (&) Is &

When multiplication and division appear in the expression at the same time, each operator is processed in the order that it appears from left to right. Similarly, when addition and subtraction appear in expressions, each operator is also processed in the order that it appears from left to right.

The string concatenation operator (&) is not an arithmetic operator, but for its precedence, it is after all arithmetic operators, and before all comparison operators. The IS operator is a comparison operator of an object reference that does not compare the value of an object or object, and only determines whether two object references refer to the same object.

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.