IBM Lotus Symphony


Instrução Static [Tempo de Execução]

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.

Ícone de Aviso 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.

Sintaxe:

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

Exemplo:

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


Feedback do Produto | Documentação Adicional | Marcas Registradas