Slash/fr: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Slash/fr
| Old | New | Line | |
|---|---|---|---|
| 1 | + | <div style="float:left; margin: 0 10px 10px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;"> | |
| 2 | + | ||
| 3 | + | / | |
| 4 | + | ||
| 5 | + | </div> | |
| 6 | + | ||
| 7 | + | Le symbole ***/*** ou **barre de fraction** est utilisé dans un programme [[Pascal/fr|Pascal]] pour faire des divisions. Le résultat est une valeur réelle. Pour obtenir un entier, il faut utiliser l'opérateur [[Div/fr|div]], ou les fonctions [[Round/fr|round]] ou [[Trunc/fr|trunc]]. Pour obtenir le reste, utilisez [[Mod/fr|mod]]. | |
| 8 | + | ||
| 9 | + | ``` pascal | |
| 10 | + | A := 3 / 4; | |
| 11 | + | ``` | |
| 12 | + | ||
| 13 | + | renvoie 0,75 si c'est un réel (si c'est un type entier, vous obtenez une erreur de compilation:Incompatible types). | |
| 14 | + | ||
| 15 | + | La valeur à droite ne doit pas être nulle (dénominateur), ou une erreur de division par zéro survient à l'exécution. Cependant, cette erreur peut être interceptée et traitée à l'aide d'un bloc [[Try/fr|try]] .. [[Finally/fr|finally]] ou [[Try/fr|try]] .. [[Except/fr|except]] | |
| 16 | + | ||
| 17 | + | --- | |
| 18 | + | *From the Free Pascal wiki, page "Slash/fr", as it stood on 2020-02-26 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](/wiki-contact).* |
