Variable Scope: Function
Imports System Imports System.Diagnostics Public Class MainClass Shared Sub Main() For i As Integer = 1 To 5 Dim j As Integer = 3 If i = j Then Dim M As Integer = i + j Console.WriteLine("M: " & M) Else Dim N As Integer = i * j Console.WriteLine("N: " & N) End If Dim k As Integer = 123 Console.WriteLine("k: " & k) Next i End Sub End Class
1. | Block scope variable X | ||
2. | Variable Scope Demo |