我正在尝试在 Pascal 中实现以下算法。帕斯卡对我来说是新的,所以我不明白问题是什么。该程序试图找到两个整数之间的最大值,如下所示:
program maqsimaluri;
function max(a,b:integer):integer;
begin
if a>=b then
max:=a
else
max:=b;
end;
negon
var a:=5;
var b:=4;
write(max(a,b));
end.
但我收到以下错误
Free Pascal Compiler version 2.2.0 [2009/11/16] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling prog.pas
prog.pas(10,5) Error: Illegal expression
prog.pas(10,9) Error: Illegal expression
prog.pas(10,9) Fatal: Syntax error, ";" expected but "identifier A" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
什么可能导致此错误,我该如何解决?