Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 4/Forward Referencing/zh CN

Sent here from Forward Referencing/zh CN.

English · Français · Български · 中文(中国) · 日本語

4F - 前向引用 (原作者: Tao Yue, 状态: 未更改)

这些虽然容易理解,但有时也让人困惑。

程序中只能使用已经定义的过程/函数?或许是这样吧,先定义后使用。

不过,也有例外,你想先使用后定义?要解决这类问题,你需要使用前向引用。(在预先声明的过程/函数后加forward)

如:

pascal
procedure Later (????????????); forward;

procedure Sooner (????????????);
begin
  ...
  Later (????????????);
end;
...
procedure Later;
begin
  ...
  Sooner (????????????);
end;

示例:

pascal
program q;

procedure a;forward;

procedure b;
begin
    writeln('B调取A:');
    a;
end;

procedure a;
begin
    writeln('A过程.');
end;

begin
    b;
end.

相关

维基百科前向声明

上一页 目录 下一页

From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 4/Forward Referencing/zh CN", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 5 people, 2013–2022

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
WangyouworldCreated page
Wangyouworld (minor)
Swen (minor)
Wangyouworld (minor)
FTurtle
TrevFixed syntax highlighting; deleted category included in page template (minor)
Kai BurghardtKai Burghardt moved page Forward Referencing/zh CN to Basic Pascal Tutorial/Chapter 4/Forward Referencing/zh CN: tidy up main name space: create subpage hierarchy for basic Pascal tutorial [cf. [[S... (minor)
Kai Burghardtbypass redirects [cf. discussion]
Kai Burghardtbypass [previously missed] redirect [cf. discussion]
Kai Burghardtbypass language bar/categorization template redirect [cf. discussion] (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.