📄 testforward.out
字号:
unit TestForward;
{ AFS 7 Feb 2K
this is legal, if somewhat obscure code
This unit compiles but is not semantically meaningfull
it is test cases for the code formatting utility
This unit tests the somewhat obscure "forward" keyword
since the only legitimate use of the forward keyword is to enable mutual recursion
This example will do that
}
interface
implementation
procedure Haggis; forward;
function Fred(b1, b2: boolean): boolean; forward;
var
liWonk: integer;
procedure Jim;
var
b: boolean;
begin
b := False;
b := Fred(True, b);
Fred(b, b);
end;
function Joe: integer; forward;
function Fred;
begin
// function body need not have the parameters specified again, or the return type. Yuk.
Result := b1 or b2;
Haggis;
end;
const
NARF = 'So, what are we going to do tonight, brain?';
function Joe: integer;
begin
Result := 3;
liWonk := 12;
end;
procedure Haggis;
begin
Fred(True, Joe > 4);
end;
procedure Bob1; forward;
procedure Bob2;
begin
Bob1;
end;
function Fugu1: integer; safecall; forward;
procedure Bob1;
begin
Bob2;
end;
function Fugu2: integer; safecall;
begin
Result := Fugu1 * 2;
end;
function Fugu1: integer;
begin
Result := Fugu2 div 2;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -