Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Variadic-function/Free-Pascal/variadic-function-1.pas
Normal file
39
Task/Variadic-function/Free-Pascal/variadic-function-1.pas
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