Declaring and instantiate an array in SmartMS

Top 

Example code : Declaring and instantiate an array in SmartMS

// Defining an array

var

  a : array of Integer;

  i : Integer;

begin

// Instantiate an array

 a := new Integer[10];

 for i := a.Low to a.High do begin

  a[i] := i;

  WriteLn(a[i]);

 end;

Result is: 1, 2, 3, 4, 5, 6, 7, 8, 9

------------------------------------------------------------------------

 

JS output:

  var a$54 = [];

  var i$5 = 0;

  var $temp27;  

  a$54 = $NewArray(10,0);

  

    for(i$5 = 0,$temp27 = a$54.length;i$5<$temp27;i$5++) {

         $DIdxW(a$54,i$5,i$5,"");

         WriteLn($DIdxR(a$54,i$5,""));

    }