Task

Show how to concatenate two arrays in your language.



If this is as simple as array1 + array2, so be it.




 
bundle Default {
  class Arithmetic {
     function : Main(args : String[]) ~ Nil {
       array1 := [3, 5, 7];
       array2 := [2, 4, 6];
 
       array3 := Copy(array1, array2);
       each(i : array3) {
         array3[i]->PrintLine();
       };
  }
 
  function : native : Copy(array1 : Int[], array2 : Int[]) ~ Int[] {
     max := array1->Size() + array2->Size();
     array3 := Int->New[max];
 
     i := 0;
     for(i := i; i < array1->Size(); i += 1;) {
       array3[i] := array1[i];
     };
 
     j := 0;
     for(i := i; i < max; i += 1;) {
       array3[i] := array2[j];
       j += 1;
     };
 
      return array3;
    }
  }
}
 