t_fwdset.mod 381 B

1234567891011
  1. MODULE TFwdSet;
  2. // SET OF a type declared later in the same TYPE block (forward type
  3. // reference): the span check is deferred until the block completes.
  4. // Exit 42.
  5. TYPE myset = SET OF colour;
  6. colour = (red, green, blue);
  7. VAR s : myset; ExitCode : INTEGER;
  8. BEGIN
  9. s := myset{red};
  10. IF (red IN s) AND NOT (green IN s) THEN ExitCode := 42 ELSE ExitCode := 1 END
  11. END TFwdSet.