Summary

The purpose of a variable is to store a value. You use the assignment statement to assign a value to a variable or property. The left side of the assignment statement is either a variable or a writable property. The right side of the assignment statement is any value, which can be a variable, constant, expression, literal, or a readable property.

Many of the data types overlap. For example, there are several data types that may represent a whole number. Often intentionally, but sometimes unintentionally, you will be converting a value between similar but not identical data types. Th is conversion between data types is called type conversion. Widening conversions, those that increase the number of bits, also are permitted. By contrast, if Option Strict is turned on, narrowing conversions, those that decrease the number of bits, are onl y permitted if done explicitly, using type conversion keywords.

Computers, in addition to being able to store vast amounts of data, are much faster and more accurate than we are in performing arithmetic calculations. You harness the computer's calculating ability using arithmetic operators. Most of the arithmetic operators are familiar, such as addition and subtraction, but a few may not be, such as integer division, which returns the quotient but not the remainder, and the Mod operator, which returns the remainder but not the quotient. You also can use the concatenation operators to combine two string values.

Finally, instead of your supplying in code the value that is assigned, you can use the InputBox function to enable your application's user to input th at value. That value, as the return value of the function, is assigned to a variable or property.

Was this article helpful?

0 0

Post a comment