Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 4/Forward Referencing/ja: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Basic Pascal Tutorial/Chapter 4/Forward Referencing/ja

OldNewLine
1+4F - 前方参照 (著者: Tao Yue, 状態: 原文のまま変更なし)
2+
3+難しいトピックが続いたが、ここでは簡単なことを話そう。
4+
5+手続きや関数はすでに定義済みの変数やサブプログラムだけを見ることができたことを思いだそう。だが、ひとつ例外がある。
6+
7+お互いが他方を呼び出している2つのサブプログラムがあるとすると、どちらを最初に置くべきかというジレンマが生じる。もう一方は最初のものからまだ呼び出せないからである。
8+
9+この「卵が先か鶏が先か」問題をとくためには _前方参照_ を使う。
10+```
11+procedure Later (parameter list); forward;
12+
13+ procedure Sooner (parameter list);
14+ begin
15+ ...
16+ Later (parameter list);
17+ end;
18+ ...
19+ procedure Later;
20+ begin
21+ ...
22+ Sooner (parameter list);
23+ end;
24+```
25+
26+関数も同様である。単にヘッディングの終わりに forward をつければ良い。
27+
28+[[Basic Pascal Tutorial/Chapter 4/Recursion/ja|previous]] | [[Basic Pascal Tutorial/Contents/ja|contents]] | [[Basic Pascal Tutorial/Chapter 4/Programming Assignment/ja|next]]
29+---|---|---
30+
31+---
32+*From the Free Pascal wiki, page "Forward Referencing/ja", as the Internet Archive kept it on 2023-03-30. 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](/wiki-contact).*

Back to history