showcase5.mod 465 B

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