Expressions and Math Operators

You should learn Visual Basic's math operators so that you can calculate and assign expression results to variables when you code assignment statements that contain expressions. An operator is a symbol or word that does math and data manipulation.

Table 7.4 describes Visual Basic's primary math operators. Other operators exist, but those in Table 7.4 suffice for most of the programs you'll write. Look over the operators. You are already familiar with most of them because they look and act like their real-world counterparts.

Table 7.4. Primary Math Operators
Operator Example Description
+ Net + Disc Adds two values
- Price - 4.25 Subtracts one value from another
* Total * Factor Multiplies two values
/ Tax / Adjust ...

Get Absolute Beginner's Guide to Programming, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.