showcase5.LST 596 B

123456789101112131415161718192021
  1. Listing:
  2. 1 MODULE Showcase5;
  3. 2 (* Step-5 tour: FROM-imported var/proc/type, qualified var/call/const,
  4. 3 exported record type, implementation init body. ExitCode = 46:
  5. 4 init total=3; Add(10) -> 13; total=13+1+2=16;
  6. 5 Get()=16+7=23; ExitCode=16+23+7=46. *)
  7. 6 FROM S5Lib IMPORT total, Add, Pair;
  8. 7 IMPORT S5Lib;
  9. 8 VAR ExitCode : INTEGER;
  10. 9 p : Pair;
  11. 10 BEGIN
  12. 11 Add(10);
  13. 12 p.a := 1; p.b := 2;
  14. 13 total := total + p.a + p.b;
  15. 14 ExitCode := total + S5Lib.Get() + S5Lib.unit
  16. 15 END Showcase5.
  17. 0 errors