| Chapter 3- Data Types and Operators | Boolean Expressions Page 2 3 4 |
| The If Statement Page 2 3 4 5 6 7 8 9 | |
| Arithmetic Operations Page 2 3 4 5 6 | Boolean Operators and Nested If Statements Page 2 3 4 5 6 7 |
| Events and Sequential Processing Page 2 3 4 5 | More Examples Page 2 3 4 5 6 7 8 9 10 11 12 |
| Datatypes and Conversions Page 2 3 4 5 6 7 | Using Check Box and Option Controls Page 2 3 4 5 6 7 8 9 10 |
| Variable Declarations - Local and Global Page 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Exercises Page 2 3 4 5 6 7 8 |
| Chapter 4- Selection Statements | Review Questions |
| Introduction | |
3-2: Arithmetic Operators (continued)
So arithmetic operators are used on the right hand side of a statement as part of an expression, the result (value) of which is assigned using the assignment operator to some named value such as a property of an object.
Table 3-1 contains most of the operators used in arithmetic.
Table 3-1: Partial List of Operators
| Operator | Usage | Description |
|---|---|---|
|
| ||
| + | result=expr1+expr2 | normally used for addition of numeric values, also catenates string values |
|
| ||
| - | result=expr1-expr2 | performs subtraction of numeric values |
|
| ||
| * | result=expr1*expr2 | performs multiplication of numeric values |
|
| ||
| / | result=expr1/expr2 | performs division of numeric values, returns a floating point result |
|
| ||
| \ | result=expr1\expr2 | performs division of numeric values, returns an integer result |
|
| ||
| ^ | result=expr1^exponent | raises a number to the power of an exponent; if expr1 is negative exponent must be positive |
|
| ||
| Mod | result=expr1 Mod expr2 | divides two numbers and returns only the remainder; values of expr1 and expr2 are rounded to integers |
|
| ||