Smart pascal source code
type
TMonRecord = record
Nom: string;
Blabla: string end;
var i: Integer;
function GetUnRecord(): TMonRecord;
begin
result.Nom := 'azerty';
result.Blabla := IntToStr(i);
i := i + 1;
end;
var toto: TMonRecord;
toto := GetUnRecord();
WriteLn(toto.Nom);
WriteLn(toto.Blabla);
toto := GetUnRecord;
WriteLn(toto.Nom);
WriteLn(toto.Blabla);
WriteLn(GetUnRecord.Nom);
WriteLn(GetUnRecord.Blabla);
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
Errors >>>>
Hint: "result" does not match case of declaration ("Result") [line: 11, column: 4]
Hint: "result" does not match case of declaration ("Result") [line: 12, column: 4]
Result >>>>
azerty
0
azerty
1
azerty
3
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
function Copy$TMonRecord(s,d) {
d.Nom=s.Nom;
d.Blabla=s.Blabla;
return d;
}
function Clone$TMonRecord($) {
return {
Nom:$.Nom,
Blabla:$.Blabla
}
}
function GetUnRecord() {
var Result = {Nom:"",Blabla:""};
Result.Nom = "azerty";
Result.Blabla = i.toString();
i+=1;
return Result
};
var i = 0;
var toto = {Nom:"",Blabla:""};
/* <<< main JS >>> */
toto = GetUnRecord();
WriteLn(toto.Nom);
WriteLn(toto.Blabla);
toto = GetUnRecord();
WriteLn(toto.Nom);
WriteLn(toto.Blabla);
WriteLn(GetUnRecord().Nom);
WriteLn(GetUnRecord().Blabla);