-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscope.pas
More file actions
34 lines (26 loc) · 719 Bytes
/
scope.pas
File metadata and controls
34 lines (26 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ Example from https://www.tutorialspoint.com/pascal/pascal_variable_scope.htm }
program scope;
var
a, b, c: integer;
procedure display;
var
a, b, c: integer;
begin
{ local variables }
a := 10;
b := 20;
c := a + b;
writeln('Winthin the procedure display');
writeln(' Displaying the global variables a, b, and c');
writeln('value of a = ', a , ', b = ', b, ' and c = ', c);
writeln('Displaying the local variables a, b, and c');
writeln('value of a = ', a , ', b = ', b, ' and c = ', c);
end;
begin
a:= 100;
b:= 200;
c:= 300;
writeln('Winthin the program exlocal');
writeln('value of a = ', a , ', b = ', b, ' and c = ', c);
display();
end.