Sign in Join
Wiki copytemporary

Function/fr

Deutsch · English · Español · Français · Suomi · Русский

Overview

Une fonction est une déclaration d'une routine qui peut être invoquée

La routine retourne une valeur dans la cadre de sa définition. Une routine qui ne retourne pas de valeur dans le cadre de sa définition est une procédure.

Une fonction qui fait partie d'une classe est appelée propriété et peut être affectée et retourner une valeur (si vous ne pouvez pas affecter de valeur, il s'agit d'une méthode.

Paramètres de fonctions

Exemples

Exemple d'addition de deux entiers :

pascal
 function add(c1, c2 : integer) : integer;
 begin
 add := c1 + c2; //or use result := in Object Pascal/Delphi mode
 end;

 var 
   total: integer;

 begin
   total := add(4, 5);
   writeln (total); // result is 9
 end.

From the Free Pascal wiki, page "Function/fr", as it stood on 2020-02-16 after a change by Trev, 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 3, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.