Operators and Conditional Statements
You have to pay close attention to the operators in JavaScript and VBScript. Some are the same, and some are different. Critical differences can be found in the use of the assignment variable (=) in both assignment statements and conditional statements. Table 15.1 shows the operators used in VBScript.
Operator | Use | Format Example |
---|---|---|
= | Assignment | inven=832 |
+ | Addition | total=item+tax+shipping |
− | Subtraction | discount=regPrice-salePrice |
* | Multiplication | itemTotal=item * units |
/ | Division | distrib=all/part |
\ | Integer division | hack=433.33\32 |
Mod | Modulus | leftOvr = 87 Mod 6 |
u | Exponentiation | cube = side ^ 3 |
& | Concatenation | FullName = “Java” & “Script” |
= | Equal to | if alpha = beta Then …. |
<> | Not ... |
Get JavaScript Design now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.