| << 4.3.0- Arithmetic and Comparison Operators | Chapter4 | 4.3.2- Comparison Operators >> |
Assignment Operator
The familiar 'equal' sign (=) is probably the most common operator in computing. You've already seen it used several times to assign values to our variables. The variable name goes on the left; the variable value goes on the right:
Number1 = 2
VBScript doesn't enforce spaces either side of the 'equal'sign, but you may prefer to include some to make your code easier to read.
Mathematical Peculiarities
You can also use the assignment operator to increase (ordecrease) the value of variables using the following, mathematically unsound,formula:
Number1 = 2
Number1 = Number1 + 1
Mathematicians will be scratching their heads, wondering howNumber1 can be equal to Number1plus 1: it's similar to saying 2 = 2 +1, which is impossible. The answer is, ofcourse, that it can't. In this example, the equals sign takes on the role of anassignment operator, as it is assigning a newvalue to Number1. It's a way of saying whateverthe old value of Number1 is, take that and add itto 1 and this value comprises the new value of Number1.
| << 4.3.0- Arithmetic and Comparison Operators | Chapter4 | 4.3.2- Comparison Operators >> |

RSS

