How to use a set of characters in Pascal

1 Answer

0 votes
program Example;
     
type
  charSet = set of Char;
var
  st: charSet;
  ch: Char;

  function printSet(st: charSet): integer;
  var
  ch: Char;

  begin
    for ch in st do
    begin
        write(ch + ' ');
    end;
    printSet := 0;
  end;

begin
  st := ['a', 'b', 'c', 'd', 'e'];

  printSet(st);
end.




(*
run:

a b c d e 

*)

 



answered Aug 16, 2022 by avibootz
...