(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Cause compiler error when Option Strict On
Module Module1
Sub Main()
Dim AnInt As Integer = 5
Dim ALong As Long = 7
ALong = AnInt
"causes compiler error when Option Strict On
"AnInt = ALong
MsgBox(AnInt)
End Sub
End Module
Option Explicit Off
Option Explicit Off
Module Explicit
Public Sub Main()
For ctr As Integer = 0 to 100
" Do something
result = cntr
Next
Console.WriteLine("The counter reached " & result & ".")
End Sub
End Module
The counter reached .
Turn Explicit off to use variable without declaration
Option Explicit Off
Module Module1
Sub Main()
EmployeeName = "Buddy Jamsa"
EmployeePhoneNumber = "555-1212"
EmployeeSalary = 45000.0
NumberOfEmployees = 1
Console.WriteLine("Number of employees: " & NumberOfEmployees)
Console.WriteLine("Employee name: " & EmployeName)
Console.WriteLine("Employee phone number: " & EmployeePhoneNumber)
Console.WriteLine("Employee salary: " & EmployeeSalary)
End Sub
End Module
Number of employees: 1
Employee name:
Employee phone number: 555-1212
Employee salary: 45000