Example - Option Explicit Statement

In this first example, y is not explicitly defined with a Dim statement.  This results in an error that the y variable is not defined:

Option Explicit
Sub Main()
   y=100
   MsgBox y
End Sub

In this second example, y is defined with the Dim statement. This code does not result in an error and the message box shows the value of y:

Option Explicit
Sub Main()
   Dim Y as Integer
   y=100
   MsgBox y
End Sub