September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
39
Task/Variadic-function/Free-Pascal/variadic-function-1.free
Normal file
39
Task/Variadic-function/Free-Pascal/variadic-function-1.free
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
program variadicRoutinesDemo(input, output, stdErr);
|
||||
{$mode objFPC}
|
||||
|
||||
// array of const is only supported in $mode objFPC or $mode Delphi
|
||||
procedure writeLines(const arguments: array of const);
|
||||
var
|
||||
argument: TVarRec;
|
||||
begin
|
||||
// inside the body `array of const` is equivalent to `array of TVarRec`
|
||||
for argument in arguments do
|
||||
begin
|
||||
with argument do
|
||||
begin
|
||||
case vType of
|
||||
vtInteger:
|
||||
begin
|
||||
writeLn(vInteger);
|
||||
end;
|
||||
vtBoolean:
|
||||
begin
|
||||
writeLn(vBoolean);
|
||||
end;
|
||||
vtChar:
|
||||
begin
|
||||
writeLn(vChar);
|
||||
end;
|
||||
vtAnsiString:
|
||||
begin
|
||||
writeLn(ansiString(vAnsiString));
|
||||
end;
|
||||
// and so on
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
writeLines([42, 'is', true, #33]);
|
||||
end.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
42
|
||||
is
|
||||
TRUE
|
||||
!
|
||||
Loading…
Add table
Add a link
Reference in a new issue