New answers tagged debugging
Monitor For the trivial example shown in the question, we could use Monitor to watch the global variable sum change in real time: Monitor[aSummer, sum] But, in general, we will probably not be so lucky that the variable or expression that we wish to monitor happens to be global -- that's why we were using Trace in the first place. TracePrint ...
One way to inspect such things without tracing is the following: Put a Dialog anywhere inside your loop, maybe with a condition that fires when you know things ran out of hand. Here an example which calls Dialog when counter is over 10000: aSummer[x_] := (counter = 0; sum = 0; While[counter >= 0, sum = sum + counter; If[counter > 10000, ...
Another alternative is the IntelliJ IDEA IDE with the Mathematica plugin. See this post for details: Open-source IntelliJIDEA plugin to support Mathematica development
Top 50 recent answers are included