IBM Lotus Symphony
|
Declara uma variável ou uma matriz no nível do procedimento em uma sub-rotina ou função, para que os valores da variável ou da matriz sejam retidos depois de encerrar a sub-rotina ou função. As convenções da instrução Dim também são válidas.
![]() |
A instrução Static não pode ser usada para definir matrizes da variável. As matrizes devem ser especificadas de acordo com um tamanho fixo. |
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,"A resposta é"
End Sub
REM Função de inicialização da variável estática
Function InitVar() As Integer
Static iInit As Integer
Const iMinimum as Integer = 40 REM valor de retorno mínimo desta função
if iInit = 0 then REM verificar se foi inicializado
iInit = iMinimum
else
iInit = iInit + 1
end if
InitVar = iInit
End Function