Example code : Array of Records with Const in SmartMS
|
type
TTwoNames = array[0..2] of string;
TMyRec = record
Nome: TTwoNames;
end;
const
NAMES1: TTwoNames = ('Warley','Alex','Sete Lagoas');
NAMES2: TTwoNames = ('Osama','Bin Laden','Alcaida');
procedure TForm1.W3Button9Click(Sender: TObject);
var
v : variant;
StringArraysList: array[0..1] of TMyRec = (
(Nome: NAMES1),
(Nome: NAMES2)
);
begin
v := StringArraysList[1];
WriteLn(v.Nome);
end;
|
|
["Osama", "Bin Laden", "Alcaida"]
JS output:
var v$4 = undefined;
var StringArraysList = [{Nome:["","",""]},{Nome:["","",""]}];
var StringArraysList = [{Nome:["Warley","Alex","Sete Lagoas"]},{Nome:["Osama","Bin Laden","Alcaida"]}];
v$4 = Clone$TMyRec(StringArraysList[1]);
WriteLn(v$4.Nome);
|
|