Denso BHT-200QW Dokumentacja Strona 83

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 587
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 82
Chapter 5. Data Types
75
5.5.4 Common Variables
A common variable should be declared in a main object beforehand. To share the common
variable by files other than the main object, you need to declare it with the COMMON statement
in each file where the common variable should be available.
File 1
DECLARE SUB
printaa(x)
COMMON a%
a%=2
printaa(5)
File 2
COMMON a%
SUB printaa(x)
print a%+x
SUB
To use a% as a common variable in Files 1 and 2, define the variable with the COMMON
statement in each file.
If a common variable declared with the COMMON statement is used within the SUB or
FUNCTION function in a file where the variable is defined, then the common variable will have
the same value.
(Example) COMMON aa%
FUNCTION addaa(x)
addaa=aa%+x
END FUNCTION
SUB printaa(x)
print aa%+x
END SUB
aa%=2
print addaa(2)
printaa(2)
In the above example, variables aa% used in "addaa" and "printaa" will be treated as same
one.
Przeglądanie stron 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 586 587

Komentarze do niniejszej Instrukcji

Brak uwag