
72
If used inside the
SUB
or
FUNCTION
function in the same file where the global variable is
defined, the variable will also have the same value.
(Example 2) The variable aa% defined by the
GLOBAL
statement will have the same value as
aa% within the
FUNCTION
.
File 1
File 2
GLOBAL aa%
GLOBAL aa%
DECLARE SUB printaa(x)
SUB printaa(x)
FUNCTION addaa(x)
print aa%+x
addaa=aa%+x
END SUB
END FUNCTION
aa%=2
print addaa(2)
printaa(2)
If you link Files 1 and 2 above into a program file, the variable aa% used in those files will have
the same value.
■
If a same name variable is used in one file where it is declared to be global
and in the other file where it is not declared
In those files where the variable is declared to be global by the
GLOBAL
statement, all of those
variables will have the same value. In a file where the variable is not declared, the variable is
available only in each file.
(Example) If in each of Files 1 and 2 the variable aa% is declared by the
GLOBAL
statement
and in File 3 the variable aa% is not declared:
File 1
File 2
File 3
GLOBAL aa%[50]
GLOBAL aa%[50]
dim aa%[50]
If you link Files 1, 2, and 3 above into a program file, the variables aa% in Files 1 and 2 will
have the same value and aa% in File 3 will be treated as a variable different from those in Files
1 and 2.
Содержание BHT-BASIC 100 SERIES
Страница 1: ......
Страница 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Страница 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Страница 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Страница 192: ...Chapter 14 Statement Reference 184 Example OPEN master Dat AS 1 FIELD 1 20 AS bar 10 AS ky CLFILE 1 CLOSE 1...
Страница 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...
Страница 349: ...341 Run time errors Error code Meaning 05h Parameter out of the range checktype is out of the range...
Страница 383: ...375 Run time errors Reference Error code Meaning 05h Parameter out of the range Functions LEFT LEN and RIGHT...