Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 4/Forward Referencing/fr

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

Tutoriel de Pascal Objet : Sous-programmes / Déclaration anticipée

Après tous ces articles embrouillés, voici quelque chose de facile.

Rappelez-vous que les procédures/fonctions ne peuvent voir que les variables et les autres sous-programmes qui sont déjà définis. Bien, il y a une exception.

Si vous avez deux sous-programmes, chacun appelle l'autre, vous êtes face à un dilemme pour lequel peu importe celui que vous placez en premier, l'autre ne peut toujours pas être appelé par le premier.

Pour résoudre ce problème de l'œuf et de la poule, utilisez une déclaration anticipée.

pascal
procedure Later (parameter list); forward;

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

La même chose fonctionne pour les fonctions. Collez seulement un forward à la fin de l'entête.


From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 4/Forward Referencing/fr", 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, 2014–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
E-ricCreated page
FTurtle
FrigoryDéclaration anticipée, et pas avancée
FrigoryRefonte
TrevFixed syntax highlighting (minor)
TrevText replacement - "Object Pascal Tutorial" to "Basic Pascal Tutorial" (minor)
Kai BurghardtKai Burghardt moved page Forward Referencing/fr to Basic Pascal Tutorial/Chapter 4/Forward Referencing/fr: 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.