Static Variables

The program demonstrates using static variables within a subroutine.

'Static Variables
'Demostrates using static variables in a subroutine
'************************************************

Sub StaticSub()
    'Dimension a static variable
    Static cnt As Integer

    'Increment the count
    cnt += 1
    Print "In StaticSub";cnt;" time(s)."
End Sub

'Dimension working variable
Dim i As Integer

'Call sub 10 times
For i = 1 To 10
    StaticSub
Next

Sleep
End