mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-14 15:52:31 +02:00
35 lines
527 B
ObjectPascal
35 lines
527 B
ObjectPascal
program test_const_string;
|
|
|
|
|
|
function astring(s :string) : string;
|
|
|
|
begin
|
|
astring:='Test string'+s;
|
|
end;
|
|
|
|
procedure testvar(var s : string);
|
|
begin
|
|
writeln('testvar s is "',s,'"');
|
|
end;
|
|
|
|
procedure testconst(const s : string);
|
|
begin
|
|
writeln('testconst s is "',s,'"');
|
|
end;
|
|
|
|
procedure testvalue(s : string);
|
|
begin
|
|
writeln('testvalue s is "',s,'"');
|
|
end;
|
|
|
|
const
|
|
s : string = 'test';
|
|
|
|
begin
|
|
testvalue(astring('e'));
|
|
testconst(astring(s));
|
|
testconst(astring(45));
|
|
{testvar(astring);refused a compile time }
|
|
end.
|
|
|