Disadvantages of Implicit Variable Declaration

• If you misspell a variable name in your procedure, Visual Basic may display a run-time error or create a new variable. You are guaranteed to waste some time troubleshooting problems that could easily have been avoided had you declared your variable at the beginning of the procedure.

• Since Visual Basic does not know what type of data your variable will store, it assigns it a Variant data type. This causes your procedure to run slower, because Visual Basic has to check the data type every time it deals with your variable. And because Variant variables can store any type of data, Visual Basic has to reserve more memory to store your data.

0 0

Post a comment