O'Reilly logo

Absolute Beginner's Guide to Programming, Second Edition by Greg Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required