Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 4/Forward Referencing/bg

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

4F - Forward Referencing (author: Tao Yue, state: unchanged)

След всички тези объркващи теми, ето нещо по-лесно.

Спомяте ли си, че процедурите / функциите могат да виждат само променливи и други подпрограми, които вече са дефинирани? Е, има изключение.

Ако имате две подпрограми, всяка от които извиква другата, имате дилемата, че без значение коя ще поставите на първо място, другата все още не може да бъде извикана от първата.

За да разрешите този проблем с кокошката и яйцето, използвайте препращане напред.

pascal
procedure Later (parameter list); forward;

procedure Sooner (parameter list);
begin
  ...
  Later (parameter list);
end;
...
procedure Later;
begin
  ...
  Sooner (parameter list);
end;

Същото важи и за функциите. Просто напишете forward; в края на заглавието.


From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 4/Forward Referencing/bg", 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 2 people, 2021–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
AlpinistbgCreated page
Alpinistbg (minor)
Kai BurghardtKai Burghardt moved page Forward Referencing/bg to Basic Pascal Tutorial/Chapter 4/Forward Referencing/bg: tidy up main name space: create subpage hierarchy for basic Pascal tutorial [cf. [[Special: P... (minor)
Kai Burghardtbypass redirects [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.