Sign in Join
Wiki copytemporary

Default parameter/de: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Default Parameter
22
3-In einer [[Procedure/de|procedure]] oder [[Function/de|function]], kann man auch Default Parameter deklarieren. Dabei muss beachtet werden, das die nur bei den letzten Paramter gestattet ist.
3+In einer [[Procedure/de|procedure]] oder [[Function/de|function]], kann man auch Default Parameter deklarieren. Dabei muss beachtet werden, das die nur bei den letzten Paramter gestattet ist.
44
5-Die letzten 2 Parameter haben Defaultwerte, und somit ist die erlaubt.
6-```
5+Die letzten 2 Parameter haben Defaultwerte, und somit ist die erlaubt.
6+
7+``` pascal
78procedure Erlaubt(a: byte; b: byte = 4; c: byte = 5);
89```
910
10-Nur der 2 Parameter hat eine Defaultwert und somit gibt dies einen Fehler.
11-```
11+Nur der 2 Parameter hat eine Defaultwert und somit gibt dies einen Fehler.
12+
13+``` pascal
1214procedure Verboten(a: byte; b: byte = 4; c: byte);
1315```
1416
15-
16-
1717## Beispiel
1818
19-Diese Beispiel zeig eine Anwendung des Default Parameter.
20-```
19+Diese Beispiel zeig eine Anwendung des Default Parameter.
20+
21+``` pascal
2122program Example;
22-
23- procedure Print(s: string; LineEnd: boolean = False);
24- begin
25- if LineEnd then begin
26- WriteLn(s);
27- end else begin
28- Write(s);
29- end;
30- end;
31-
32- begin
33- Print('Hello '); // Entspricht Print('Hello ', False);
34- Print('World !', True);
35- Print('======', False);
36- Print('=======', True);
37- end.
23+
24+ procedure Print(s: string; LineEnd: boolean = False);
25+ begin
26+ if LineEnd then begin
27+ WriteLn(s);
28+ end else begin
29+ Write(s);
30+ end;
31+ end;
32+
33+begin
34+ Print('Hello '); // Entspricht Print('Hello ', False);
35+ Print('World !', True);
36+ Print('======', False);
37+ Print('=======', True);
38+end.
3839```
3940
40-Autor: [Mathias](</User:Mathias> "User:Mathias")
41+Autor: Mathias
4142
4243---
43-*From the Free Pascal wiki, page "Default parameter/de", as the Internet Archive kept it on 2022-11-28. 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).*
44+*From the Free Pascal wiki, page "Default parameter/de", as it stood on 2020-02-12 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