0

I have:

myres = {};
Do[
 Do[
  Append[myres, {j, i}], {i, 1, 3}
  ],
 {j, 1, 5}
 ]

However, when I run the code and then enter:

myres

I get:

(* { } *)

Why is it empty? Can someone explain my misunderstanding? Also, could someone suggest some lines in the code that will show some intermediate results as to what is happening?

David
  • 14,883
  • 4
  • 44
  • 117

1 Answers1

1

Append is not a mutator. You either need myres = Append[...] or AppendTo[...].

As far as monitoring, you could simply add Print statements, or try Monitor.

ZachB
  • 1,200
  • 9
  • 19