Epson RC170 Guia do Utilizador Página 172

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 312
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 171
6. The SPEL+ Language
6.7 Working with variables
6.7.1 Variable scopes
There are three different scopes for variables in SPEL
+
:
- Local
- Module
- Global
6.7.2 Local variables
Local variables are available to all statements in the same function. Functions using local
variable names can not refer to the same local variables in other functions. This is why
they are called locals, because they are local to the function they are being used in.
To declare local variables in a function, use one of the variable declaration instructions at
the beginning of the function after the Function statement:
Boolean, Byte, Integer, Long, Real, Double, String
For example, the following function declares several local variables:
Function test
Integer intVar1, intVar2
Real realVar
String dataStr$
Integer array(10)
.....
Fend
6.7.3 Module variables
Module variables are available to all functions in the same program file.
To declare module variables in a program, use one of the variable declaration instructions
at the beginning of the program before any Function statements:
Boolean, Byte, Integer, Long, Real, Double, String
One way to indicate that a variable is module level is to precede the name with "m_", as
shown in the example below.
For example, the following function declares several module level variables:
' Module level vars, used by all functions in this file
Integer m_IntVar1, m_IntVar2
Real m_RealVar
String m_DataStr$
Integer m_Array(10)
Function main
m_IntVar1 = 25
Call test
Fend
Function test
Print m_IntVar1
Fend
154 EPSON RC+ 5.0 (Ver.5.4) User's Guide Rev.4
Vista de página 171
1 2 ... 167 168 169 170 171 172 173 174 175 176 177 ... 311 312

Comentários a estes Manuais

Sem comentários