我正在使用Pascal语言完成一项作业,但是遇到了这个错误:“需要分号,但是找到了Else”。我看到了很多类似的问题并尝试着去借鉴,但是没有成功。
我的代码:
Program TeamWrite;
Var FName, txt : String[10];
UserFile : Text;
BEGIN
FName := 'Team';
Assign(UserFile, 'C:\Team.dat');
Rewrite(UserFile);
Writeln('Enter players name and score separated by a space, type end to finish');
if txt = 'end' then;
BEGIN
Close(UserFile)
End;
Else
BEGIN
Readln(txt);
Writeln;
Writeln(UserFile,txt);
End;
Until(txt = 'end');
End.