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