VBScript Basic tutorial six VBScript operators

Source: Internet
Author: User
Tags arithmetic arithmetic operators comparison contains expression logical operators reference
Vbscript| Basic Tutorial | Operation VBScript has a complete set of operators, including arithmetic operators, comparison operators, join operators, and logical operators.

Operator Precedence

When an expression contains more than one operator, each part is evaluated in a predetermined order, which is called the operator precedence. You can use parentheses to cross this order of precedence, forcing some parts of an expression to be evaluated first. Operation, the operator in parentheses is always executed first, and then the operators outside the parentheses are executed. However, the standard operator precedence is still followed in parentheses.

When an expression contains more than one operator, the arithmetic operator is evaluated first, the comparison operator is computed, and the logical operator is finally computed. All comparison operators have the same precedence, that is, the comparison operator is computed in left-to-right order. The precedence of arithmetic operators and logical operators is as follows:

Arithmetic operators Comparison operators logical operators
Describe Symbol Describe Symbol Describe Symbol
exponentiation ^ Equals = Logical non Not
Minus sign - Not equal to <> Logic and and
By * Less than < Logical OR Or
Except / Greater than > Logical XOR or Xor
Divisible \ Less than or equal to <= Logical equivalence Eqv
Find Yu Mod Greater than or equal to >= Logical implied Imp
Add + Object reference Comparison Is
Reducing -
string concatenation &


When multiplication and division appear in an expression at the same time, the multiply, except operators are computed in left-to-right order. Also, when addition and subtraction appear in an expression, the addition and subtraction operators are computed from left to right.

The string concatenation (&) operator is not an arithmetic operator, but in the order of precedence, it is ranked after all arithmetic operators and before all comparison operators. The IS operator is an object reference comparison operator. It does not compare the values of objects or objects, but simply checks to see 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.