File: test4c.mod

package info (click to toggle)
m2c 0.6-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,096 kB
  • ctags: 1,907
  • sloc: ansic: 18,088; sh: 168; makefile: 60
file content (25 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (5)
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
(* p.135 3b-2b *)

(* declarations and scope rules *)

(* The scope extends over the entire block ( procedure or        *)
(*   module declaration) to which the declaration belongs and    *)
(*   to which the object is local.                               *)

(* LockVar is not visible outside P1 *)

MODULE test4c;

 PROCEDURE P1():CARDINAL;
  VAR
     LockVar:CARDINAL;
  BEGIN
   LockVar:=1; GlobVar:=0;
   RETURN LockVar+3;
  END P1;

 VAR
    GlobVar:CARDINAL;
 BEGIN
  GlobVar:=3*LockVar+P1();
 END test4c.