"+" - Arithmetic Addition Operation

This section provides some detail rules and a tutorial example on how arithmetic addition operation works in VBScript.

Here are some detail rules about the arithmetic operation - Addition:

Here is a tutorial example showing you how arithmetic addition operation rules work:

<html>
<body>
<!-- addition_operation.html
 - Copyright (c) 1998 HerongYang.com. All Rights Reserved.
-->
<pre>
<script language="vbscript">
   document.writeln("7+7=" & (7+7) & " : " & TypeName(7+7))
   document.writeln("7+777777=" & (7+777777) & " : " _ 
      & TypeName(7+777777))
   document.writeln("7+9.99=" & (7+9.99) & " : " & TypeName(7+9.99))
   document.writeln("7+333.333e200=" & (7+333.333e200) & " : " _
      & TypeName(7+333.333e200))
   document.writeln("7+""7""=" & (7+"7") & " : " & TypeName(7+"7"))
'  document.writeln("7+""7Hello""=" & (7+"7Hello") & " : " _
'     & TypeName(7+"7Hello"))
   document.writeln("7+True=" & (7+True) & " : " & TypeName(7+True))
   document.writeln("7+False=" & (7+False) & " : " _
      & TypeName(7+False))
   document.writeln("True+False=" & (True+False) & " : " _
      & TypeName(True+False))
   document.writeln("7+Empty=" & (7+Empty) & " : " _ 
      & TypeName(7+Empty))
</script>
</pre>
</body>
</html>

Here is the output of this VBScript example script:

7+7=14 : Integer
7+777777=777784 : Long
7+9.99=16.99 : Double
7+333.333e200=3.33333E+202 : Double
7+"7"=14 : Double
7+True=6 : Integer
7+False=7 : Integer
True+False=-1 : Integer
7+Empty=7 : Integer

The output confirms some of arithmetic addition operation rules:

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

Arithmetic Operations

 Introduction of Arithmetic Operations

"+" - Arithmetic Addition Operation

 "-" - Arithmetic Subtraction Operation

 "*" - Arithmetic Multiplication Operation

 "/" - Arithmetic Division Operation

 "\" - Arithmetic Integer Division Operation

 "Mod" - Arithmetic Modulus Operation

 "^" - Arithmetic Exponentiation Operation

 Numeric Comparison Operations and Logical Operations

 String Operations - Concatenation and Comparison

 Variable Declaration and Assignment Statement

 Expression and Order of Operation Precedence

 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