Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
Forward declaration
A function can be declared without having it followed by it's implementation, by hav-
ing it followed by the forward procedure. The effective implementation of that func-
tion must follow later in the module. The function can be used after a forward dec-
laration as if it had been implemented already. The following is an example of a for-
ward declaration:
program Volume
dim Volume as word
sub function First(a as word, b as wordas word forward
sub function Second(c as wordas word
dim 
tmp as word
tmp = First(2, 3)
result = tmp * c
end sub
sub function First(a, b as wordas word
result = a * b
end sub
main:
Volume = Second(4)
end.
135
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroBasic PRO for AVR
CHAPTER 5