IBM Lotus Symphony
|
Deklarira spremenljivko ali matriko na ravni procedure znotraj podprograma ali funkcije, tako da se vrednosti spremenljivke ali matrike zadržijo po izhodu iz podprograma ali funkcije. Pravila stavka Dim so prav tako veljavna.
![]() |
Stavka Static ni mogoče uporabiti za definiranje spremenljivk matrik. Matrike morajo biti podane skladno s fiksno velikostjo. |
Static VarName[(start To end)] [As VarType], VarName2[(start To end)] [As VarType], ...
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