Block scope variable X : Variable Scope « Language Basics « VB.Net






Block scope variable X

Block scope variable X
Imports System

public class MainClass
   Shared Sub Main()
        Dim Counter As Short
        For Counter = 1 To 3
            If True Then '  Always enter this block
                Dim X As Short
                Console.WriteLine(X)
                X = Counter
            End If
        Next Counter


   End Sub

End Class


           
       








Related examples in the same category

1.Variable Scope DemoVariable Scope Demo
2.Variable Scope: Function