tb0172.pp 751 B

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