IBM Lotus Symphony


Static Statement [Runtime]

Declares a variable or an array at the procedure level within a subroutine or a function, so that the values of the variable or the array are retained after exiting the subroutine or function. Dim statement conventions are also valid.

Warning Icon The Static statement cannot be used to define variable arrays. Arrays must be specified according to a fixed size.

Syntax:

Static VarName[(start To end)] [As VarType], VarName2[(start To end)] [As VarType], ...

Example:

Sub ExampleStatic

Dim iCount as Integer, iResult as Integer

For iCount = 0 to 2

iResult = InitVar()

Next iCount

MsgBox iResult,0,"The answer is"

End Sub

REM Function for initialization of the static variable

Function InitVar() As Integer

Static iInit As Integer

Const iMinimum as Integer = 40 REM minimum return value of this function

if iInit = 0 then REM check if initialized

iInit = iMinimum

else

iInit = iInit + 1

end if

InitVar = iInit

End Function


Product Feedback | Additional Documentation | Trademarks