The Sort Method with Arrays



The Sort Method.
Pas2JS pascal source code
var aInt : array of Integer; aFloat : array of Float; aStr : array of String; begin for var i:=1 to 19 do begin var k:=i xor 13; aInt.Add(k); aFloat.Add(k-1.5); aStr.Add('z'+k.ToString); end; aInt.Sort; for var e in aInt do WriteLn(e.ToString+','); // 0,1,2,3,4,5,6,7,8,9,10,11,12,14,15,28,29,30,31, WriteLn(''); aFloat.Sort; for var e in aFloat do WriteLn(e.ToString+','); // -1.5,-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,12.5,13.5,26.5,27.5,28.5,29.5, WriteLn(''); aStr.Sort; WriteLn(aStr.Join(',')); // z0,z1,z10,z11,z12,z14,z15,z2,z28,z29,z3,z30,z31,z4,z5,z6,z7,z8,z9