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+``` pascal
12+procedure Later (parameter list); forward;
13+
14+procedure Sooner (parameter list);
15+begin
16+ ...
17+ Later (parameter list);
18+end;
19+...
20+procedure Later;
21+begin
22+ ...
23+ Sooner (parameter list);
24+end;
25+```
26+
27+関数も同様である。単にヘッディングの終わりに forward をつければ良い。
28+
29+| | | |
30+|----|----|----|
31+| [[Basic Pascal Tutorial/Chapter 4/Recursion/ja|previous]] | [[Basic Pascal Tutorial/Contents/ja|contents]] | [[Basic Pascal Tutorial/Chapter 4/Programming Assignment/ja|next]] |
32+
33+---
34+*From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 4/Forward Referencing/ja", 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](/wiki-contact).*

Back to history