tbs0204.pp 651 B

123456789101112131415161718192021222324252627282930
  1. { boolean(byte) byte(boolean)
  2. word(wordbool) wordbool(word)
  3. longint(longbool) and longbool(longint)
  4. must be accepted as var parameters
  5. or a left of an assignment }
  6. procedure error;
  7. begin
  8. Writeln('Error in tbs0204');
  9. Halt(1);
  10. end;
  11. var
  12. b : boolean;
  13. wb : wordbool;
  14. lb : longbool;
  15. begin
  16. byte(b):=1;
  17. word(wb):=1;
  18. longint(lb):=1;
  19. if (not b) or (not wb) or (not lb) then
  20. error;
  21. byte(b):=2;
  22. Writeln('if a boolean contains 2 it is considered as ',b);
  23. byte(b):=3;
  24. Writeln('if a boolean contains 3 it is considered as ',b);
  25. shortint(b):=-1;
  26. Writeln('if a boolean contains shortint(-1) it is considered as ',b);
  27. end.