t81_upcase.pas 669 B

123456789101112131415161718192021222324
  1. program t81_upcase;
  2. { t81 -- UpCase on a CHAR.
  3. CALC.INC's Clear ends `until Upcase(Ch) in ['Y','N']'. TP3's UpCase is a
  4. CHAR function here (later versions also accept a string, which stays ENoLib
  5. until a string implementation exists): 'a'..'z' fold to 'A'..'Z', everything
  6. else is unchanged. A constant folds at compile time; a variable is compared
  7. and decremented at run time. }
  8. var
  9. c : char;
  10. begin
  11. c := 'a';
  12. writeln (Upcase (c));
  13. c := 'z';
  14. writeln (Upcase (c));
  15. c := 'A';
  16. writeln (Upcase (c));
  17. c := '5';
  18. writeln (Upcase (c));
  19. writeln (Upcase ('q'));
  20. if Upcase (c) = '5' then writeln ('same') else writeln ('diff')
  21. end.