0

Why doesn't this work:

mergeList[a_, b_] := (
  list = a;
  Insert[list, 98, 3];
  Do[
   Do[
    (
     If[
      b[[f]] < list[[s]],
      (Insert[list, b[[f]], s]; Break[])
      ]
     ),
    {s, Length[list]}
    ],
   {f, Length[b]}
   ];
  list
  )

It doesn't give an error, it just outputs the original value of list = a

For example:

mergeList[{1, 2, 3, 4}, {2, 3, 4, 5}]

outputs {1, 2, 3, 4}, and I don't know why.

kukac67
  • 111
  • 2

0 Answers0