Smart pascal source code
type
Tmt = record
c1: String;
c2: string;
end;
function titi: Tmt;
begin
result.c1 := 'aaa';
result.c2 := 'bbb';
end;
procedure toto(a: Tmt);
begin
WriteLn(a.c1 + #13#10 + a.c2);
end;
toto(titi); // marche pas
var x := titi; // marche
toto(x);
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
Errors >>>>
Hint: "result" does not match case of declaration ("Result") [line: 10, column: 4]
Hint: "result" does not match case of declaration ("Result") [line: 11, column: 4]
Result >>>>
aaa
bbb
aaa
bbb
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
function toto(a) {
WriteLn((a.c1+"\r\n"+a.c2));
};
function Copy$Tmt(s,d) {
d.c1=s.c1;
d.c2=s.c2;
return d;
}
function Clone$Tmt($) {
return {
c1:$.c1,
c2:$.c2
}
}
function titi() {
var Result = {c1:"",c2:""};
Result.c1 = "aaa";
Result.c2 = "bbb";
return Result
};
var x = {c1:"",c2:""};
/* <<< main JS >>> */
toto(titi());
x = titi();
toto(Clone$Tmt(x));