P
P
Pavel2015-04-12 20:23:35
Delphi
Pavel, 2015-04-12 20:23:35

Why does the program display the message "Type mismatch"?

I am new to programming and have written a program in Delphi that should determine which latin characters occur in a given string. The following error appears - "Type mismatch" (the line with the error is indicated as a comment):

Program MMM;
var
Stroka : string;
LChars : set of 'a'..'z';
simv : char;
i : integer;
begin
Readln(Stroka);
LChars:= [];

for i:= 1 to Length(Stroka) do
   if Stroka[i] in ['a'..'z'] then LChars:= LChars + Stroka[i];  // В этой строке выходит указанная ошибка

for Simv:= 'a' to 'z' do if simv in LChars then Write(simv, '  ');

readln;
end.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Vitrenko, 2015-04-12
@Pavel333

In the line with an error, use the Include
procedure instead . There is also such a form of writing through the operator +
LChars:= LChars + [Stroka[i]];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question