Forum > Beginners
missed semicolon.
(1/1)
angel208:
hello. I've got an assignment on my yesterday class. i need to make a program that reads characters and if they are (1,2,3,4), the program will show (a,b,c,d) respectively. the teacher specified that it need to be done using a function. when i "finished", the compiler gave me an error because it was a semicolon missed before the end of the program, but no matter how much i try to fix it, it keeps giving that error. i would appreciate if you guys could help me. my code until now is:
--- Code: ---program funcion;
uses crt;
var num: char;
Function search(a:char): char;
Begin
case a of '1':
search:='a';
'2':
search:='b';
'3':
search:='c';
end;
begin
writeln ('type in a character');
readln (num);
writeln (search(num));
end.
--- End code ---
i would appreciate any help with the code. (sorry for my grammar, my mother language is Spanish).
engkin:
You need to close your case statement with an end
--- Quote ---Function search(a:char): char;
Begin
case a of '1':
search:='a';
'2':
search:='b';
'3':
search:='c';
end; //<----- is missing
end;
--- End quote ---
angel208:
wow, thank you for the fast response. that was exactly the problem. thank you very much
Navigation
[0] Message Index