VBS Tutorial: Operator-operator priority

Source: Internet
Author: User

Operator priority

When multiple operations are performed in an expression, each part is computed and solved in a predetermined order. This order is called the operator priority. Parentheses can change the priority order and force a certain part of the expression to be prioritized. The operations in the brackets are always executed before the operations outside the brackets. However, the operator priority remains normal within the brackets.

When an expression has multiple operators, it first processes Arithmetic Operators, then comparison operators, and then logical operators. All comparison operators have the same priority, that is, they are processed from left to right in the order they appear. Arithmetic Operators and logical operators are processed according to the following priorities:

Arithmetic Comparison Logic
Exponential operation (^) Equal (=) Not
Negative (-) Unequal (<>) And
Multiplication and division (*,/) Less (<) Or
Division (\) Greater (>) Xor
Remainder operation (Mod) Less than or equal (<=) Eqv
Addition and subtraction (+,-) Greater than or equal (> =) Imp
String connection (&) Is &

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

String concatenation operator (&) Is not an arithmetic operator, but in terms of its priority, it is after all Arithmetic Operators, and before all comparison operators.IsAn operator is a comparison operator referenced by an object. It does not compare the value of an object or an object, but only checks whether two objects reference 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.