Showcase4.mod 556 B

1234567891011121314151617181920212223242526
  1. MODULE Showcase4;
  2. (* Step-11 tour: DEFINITION/IMPLEMENTATION library, IMPORT + FROM,
  3. qualified and unqualified use, lib init before program body. *)
  4. FROM S4L IMPORT Pair, Add;
  5. VAR p, q : Pair;
  6. VAR w : INTEGER;
  7. VAR total : INTEGER;
  8. VAR ExitCode : INTEGER;
  9. BEGIN
  10. total := 0;
  11. WriteString("show4");
  12. w := S4L.n;
  13. S4L.Bump(w);
  14. S4L.n := w;
  15. total := total + S4L.n;
  16. p.a := 1; p.b := 2;
  17. q := p;
  18. total := total + q.a + q.b;
  19. total := total + Add(S4L.base, 5);
  20. total := total + S4L.base;
  21. WriteInt(total);
  22. ExitCode := total
  23. END Showcase4.