Mega Code Archive

 
Categories / VB.Net Tutorial / Language Basics
 

Static Variable

Option Strict On Public Module Test    Public Sub Main()       For loopCtr As Integer = 1 to 10          Console.WriteLine(Invocations())       Next    End Sub    Private Function Invocations() As Integer       Static i As Integer       i += 1       Return i    End Function End Module 1 2 3 4 5 6 7 8 9 10