Static Statement

 

Static variable

    

Used to declare variables and allocate storage space.  These variables will retain their value through the program run

 

Related Topics: Dim, Function, Sub

 

Example:

 

' This example shows how to use the static keyword to retain the value of

' the variable i in sub Joe.  If Dim is used instead of Static then i

' is empty when printed on the second call as well as the first.

 

Sub Main

    For i = 1 to 2

        Joe 2

    Next i

End Sub

 

Sub Joe( j as integer )

    Static i

    print i

    i = i + 5

    print i

End Sub