May 2004
Intermediate to advanced
888 pages
22h 31m
English
Scope refers to some part of your program in which a given function or variable is visible to the compiler. A global constant is in scope at all points in your program, for example, whereas a variable local to some procedure only has scope within that procedure. Consider Listing 5.2.
1: program Foo;
2:
3: {$APPTYPE CONSOLE}
4:
5: const
6: SomeConstant = 100;
7:
8: var
9: SomeGlobal: Integer;
10: D: Double;
11:
12: procedure SomeProc;
13: var
14: D, LocalD: Double;
15: begin
16: LocalD := 10.0;
17: D := D - LocalD;
18: end;
19:
20: begin
21: SomeGlobal := SomeConstant;
22: D := 4.593;
23: SomeProc;
24: end.
|
SomeConstant, SomeGlobal, and D have global scope—their values are known to the compiler at all ...
Read now
Unlock full access