Home > Available Help Files > PC-DMIS BASIC Language > Language Reference A – Z > Option Explicit Statement > Example - Option Explicit Statement
Current Help File: PC-DMIS Basic (View Core Help)
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