-optionexplicit
Causes the compiler to report errors if variables are not declared before they are used.
Syntax
-optionexplicit[+ | -]
Arguments
+
| -
Optional. Specify -optionexplicit+
to require explicit declaration of variables. The -optionexplicit+
option is the default and is the same as -optionexplicit
. The -optionexplicit-
option enables implicit declaration of variables.
Remarks
If the source code file contains an Option Explicit statement, the statement overrides the -optionexplicit
command-line compiler setting.
To set -optionexplicit in the Visual Studio IDE
Have a project selected in Solution Explorer. On the Project menu, click Properties.
Click the Compile tab.
Modify the value in the Option Explicit box.
Example
The following code compiles when -optionexplicit-
is used.
Module Module1
Sub Main()
i = 99
System.Console.WriteLine(i)
End Sub
End Module
See also
प्रतिक्रिया
https://aka.ms/ContentUserFeedback.
जल्द आ रहा है: 2024 के दौरान हम सामग्री के लिए फीडबैक तंत्र के रूप में GitHub मुद्दों को चरणबद्ध तरीके से समाप्त कर देंगे और इसे एक नई फीडबैक प्रणाली से बदल देंगे. अधिक जानकारी के लिए, देखें:के लिए प्रतिक्रिया सबमिट करें और देखें