Static Statement [Runtime] /text/sbasic/shared/03103500.xhp Sun Microsystems, Inc. converted from old format - fpe
Static statement 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.
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 Static iInit As Integer if iInit = 0 then iInit = InitVar() REM Test if variable is already initialized iInit = iInit + 1 MsgBox iInit,0,"The answer is" End Sub REM Function for initialization of the static variable Function InitVar() As Integer InitVar = 40 REM any value for initialization End Function