When one was writing programs back in the early days of
BASIC,
variables could be used without being
declared. The
interpreter would fill in the gaps for you so that beginners would never have to meddle with the
black arts of
integers,
strings and
long numbers thusly avoiding
confusion and (supposedly) allowing them to grasp
programming concepts with ease.
You could more or less write programs like:
10 x=51231231321
20 y=2.3
30 z=-462
40 a=x*y*z
50 print a
And the program would return something like: -54438306401694.6
Nothing really wrong with that, it's an accurate calculation, but the interpreter HAD to figure out for itself what types of numbers it was dealing with before it could do the math. This is what a lot of programmers had a problem with. The code was sluggish and used up more system resources than it needed to. Bad news for the seasoned veteran, good news for the newbie.
Flash forward to the present day and Visual Basic. Option Explicit is now used in all modules to avoid the problem of undeclared variables in that it forces you to declare them or else the program will return errors at compile time. The result is faster, easier to follow, easier to debug code. This is good because the system doesn't have to do it itself, and it is also good practice for other programming languages.