Precedences of Operations

This section provides the order of precedence for operations commonly used in VBScript. Operations in a complex expression must be evaluated according to the order of operation precedence.

In the previous section, we learned that operations in a complex expression must be evaluated according to the order of operation precedence. The following table shows you the relative order of precedence for some commonly used operations:

Precedence   Operations       Notes

12           (...)            Operation group
11           ^                Exponentiation
10           -                Unary negation
9            * / \ Mod        Multiplication, Division, ...
8            + -              Addition and Subtraction
7            & +              String concatenation
6            = <> < > <= >=   Comparisons
5            Not             Logical negation
4            And             Logical conjunction 
3            Or              Logical disjunction
2            Xor             Logical exclusion
1            Eqv             Logical equivalence   
0            Imp             Logical implication

Remember that:

See the next section for examples of expressions and evaluation orders.

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 Numeric Comparison Operations and Logical Operations

 String Operations - Concatenation and Comparison

 Variable Declaration and Assignment Statement

Expression and Order of Operation Precedence

 What Is an Expression?

Precedences of Operations

 Examples of Expressions

 Statement Syntax and Statement Types

 Array Data Type and Related Statements

 Array References and Array Assignment Statements

 Conditional Statements - "If ... Then" and "Select Case"

 Loop Statements - "For", "While", and "Do"

 "Function" and "Sub" Procedures

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

 WSH (Windows Script Host)

 References

 Full Version in PDF/EPUB