Sign in Join
Wiki copytemporary

leap year/de: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: leap year/de

OldNewLine
1+Zurück zur Seite [[code examples/de|Code Beispiele]].
2+
3+Dieses Beispiel prüft, ob das Jahr ein (christliches) Schaltjahr ab dem Jahr 1582 ist.
4+
5+Alternativ gibt es dazu in der Unit Sysutils die Funktion leap year (leap year = Schaltjahr).
6+
7+``` pascal
8+function funIstSchaltjahr(wrdJahr: word): integer;
9+const
10+ conKalenderumstellung = 1583;
11+ conFehler = -1;
12+ conFalsch = 0;
13+ conWahr = 1;
14+
15+begin
16+
17+ Result := conFehler;
18+ // Prüft auf die Richtigkeit des Kalenderjahres
19+ if wrdJahr < conKalenderumstellung then
20+ exit;
21+
22+ Result := conFalsch;
23+
24+ if (wrdJahr mod 4) = 0 then
25+ Result := conWahr;
26+ if (wrdJahr mod 100) = 0 then
27+ Result := 0;
28+ if (wrdJahr mod 400) = 0 then
29+ Result := conWahr;
30+
31+end;
32+```
33+
34+## See also
35+
36+Talk:leap year/de
37+
38+---
39+*From the Free Pascal wiki, page "leap year/de", as it stood on 2020-02-19 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).*

Back to history