Skip to Main Content
VBScript in a Nutshell, 2nd Edition
book

VBScript in a Nutshell, 2nd Edition

by Paul Lomax, Matt Childs, Ron Petrusha
March 2003
Intermediate to advanced content levelIntermediate to advanced
512 pages
14h 30m
English
O'Reilly Media, Inc.
Content preview from VBScript in a Nutshell, 2nd Edition

Appendix C. Operators

There are four groups of operators in VBScript: arithmetic, concatenation, comparison, and logical. You’ll find some to be instantly recognizable, while others may be unfamiliar. However, if you have the need to use these types of operators, it is likely that you know the mathematics fundamentals behind them. We will look at each group of operators in turn before discussing the order of precedence VBScript uses when it encounters more than one type of operator within an expression.

Arithmetic Operators

+

The addition operator. Used to add numeric expressions, as well as to concatenate (join together) two string variables. However, it’s preferable to use the concatenation operator with strings to eliminate ambiguity. For example:

result = expression1 + expression2
-

The subtraction operator. Used to find the difference between two numeric values or expressions, as well as to denote a negative value. Unlike the addition operator, it cannot be used with string variables. For example:

result = expression1 - expression2
/

The division operator. Returns a floating-point number.

result = expression1 / expression2
*

The multiplication operator. Used to multiply two numerical values. For example:

result = expression1 * expression2
\

The integer division operator. Performs division on two numeric expressions and returns an integer result (no remainder or decimal places). For example:

result = expression1 \ expression2
Mod

The modulo operator. Performs division on two numeric expressions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VBScript in a Nutshell

VBScript in a Nutshell

Matt Childs, Paul Lomax, Ron Petrusha
Microsoft® PowerShell, VBScript and JScript® Bible

Microsoft® PowerShell, VBScript and JScript® Bible

William R. Stanek, James O'Neill, Jeffrey Rosen

Publisher Resources

ISBN: 0596004885Errata Page