从书上拷了一段递归调用的代码来执行,如下:
program console9;
{$APPTYPE CONSOLE}
var
alpha:Integer;
procedure Test2(var A:Integer):forword;
{Test2被说明为前置过程}
procedure Test1(var A:Integer);
begin
A :=A-1;
if A>0 then
test2(A); {经前置说明,调用未执行的过程Test2}
writeln(A);
end;
procedure Test2(var A:Integer);
{经前置说明的Test2的执行部分}
begin
A :=A div 2;
if A>0 rhen
test1(A); {在Test2中调用已执行的过程Test1}
end;
begin
Alpha := 15; {给Alpha赋初值}
Test1(Alpha); { 第一次调用Test1,递归开始}
end;
可编译时却在procedure Test2(var A:Integer):forword;报错,错误提示如下:
[Error] console9.dpr(8): Undeclared identifier: forword
郁闷,请问大哥们,小弟这是哪里做错了?
procedure Test2(var A:Integer);forward;//是分号不是冒号