Home > Available Help Files > PC-DMIS BASIC Language > Language Reference A – Z > Static Statement > Example - Static Statement
Current Help File: PC-DMIS Basic (View Core Help)
Example - Static Statement
' This example shows how To use the Static keyword to retain the value of ' the variable i in the AddValue subroutine. When defining i, if Dim is used instead of Static ' then i is empty when printed On the second call as well as the first call. Sub Main() For j = 1 To 2 Call AddValue Next j End Sub Sub AddValue ( ) Static i MsgBox "In AddValue. i is " & i i = i + 5 MsgBox "In AddValue. Added five to i. i is now " & i End Sub