VBS Tutorial: VBScript basics-VBScript Operator

Source: Internet
Author: User

VBScript Operator

VBScript has a complete set of operators, including Arithmetic Operators, comparison operators, join operators, and logical operators.

Operator priority

When an expression contains multiple operators, each part is calculated in a predetermined order, which is called the operator priority. You can use parentheses to overwrite the priority order and force some parts of the expression to be calculated first. During operation, operators in parentheses are always executed first, and then operators outside parentheses are executed. However, the standard operator priority is still observed in parentheses.

When an expression contains multiple operators, the arithmetic operators are calculated first, then the comparison operators are calculated, and finally the logical operators are calculated. All comparison operators have the same priority, that is, the comparison operators are calculated from left to right. The priority of Arithmetic Operators and logical operators is as follows:

Arithmetic Operators Comparison Operators Logical operators
Description Symbol Description Symbol Description Symbol
Power ^ Equal = Non-logical Not
Negative number - Not equal <> Logic and And
Multiplication * Less < Logic or Or
Division / Greater > Logic exclusive or Xor
Division \ Less than or equal <= Logical equivalence Eqv
Remainder Mod Greater than or equal > = Logical implicit Imp
Add + Object Reference comparison Is
Subtraction -
String connection &

When the multiplication and division numbers appear in the same expression at the same time, the multiplication and division operators are calculated from left to right. When addition and subtraction appear in an expression at the same time, the addition and subtraction operators are calculated from left to right.

The String concatenation (&) operator is not an arithmetic operator, but in the priority order, it is placed after all Arithmetic Operators and before all comparison operators.IsAn operator is an object reference comparison operator. It does not compare the values of objects or objects, 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.