unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}var
alpha:integer;
procedure test2(var a:integer):forword; //在此报错procedure test1(var a :integer);
begin
a:=a-1;
if a>0 then
test2(a);
writeln(a);
end;
procedure test2(var a:integer);
begin
a:=a div 2;
if a>0 then
test1(a);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
alpha:=15;
test1(alpha);
end;end.
报错信息:[错误] Unit1.pas(29): Undeclared identifier: 'forword'为什么会这样?我错在哪里,请大家指点?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}var
alpha:integer;
procedure test2(var a:integer):forword; //在此报错procedure test1(var a :integer);
begin
a:=a-1;
if a>0 then
test2(a);
writeln(a);
end;
procedure test2(var a:integer);
begin
a:=a div 2;
if a>0 then
test1(a);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
alpha:=15;
test1(alpha);
end;end.
报错信息:[错误] Unit1.pas(29): Undeclared identifier: 'forword'为什么会这样?我错在哪里,请大家指点?
procedure test2(var a:integer); forward;而不是:
procedure test2(var a:integer):forword; //在此报错这里面有两处错误, 一是forward拼写错误, 二是应该用分号的地方写成了冒号