Syntax |
variable = expression |
Description |
Assigns the result of an expression to a variable. |
Comments |
When assigning expressions to variables, internal type conversions are performed automatically between any two numeric quantities. Thus, you can freely assign numeric quantities without regard to type conversions. However, it is possible for an overflow error to occur when converting from larger to smaller types. This occurs when the larger type contains a numeric quantity that cannot be represented by the smaller type. For example, the following code will produce a runtime error: Dim
amount As Long amount
= 400123 'Assign a value out of range for
int. When performing an automatic data conversion, underflow is not an error. |
|
The assignment operator (=) cannot be used to assign objects. Use the Set statement instead. |
Example |
Sub Main() |
See Also |
Let (statement); Operator Precedence (topic); Set (statement); Expression Evaluation (topic). |
Symbols |