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, Second Edition 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.