Not clear how you are going to "look at what went wrong" by stopping a function that just prints values. Isn't it too late at that point since the values have already been computed? Some suggestions:
Add ;
after each of the Print
, without that it is a single expression that is the product of the result of evaluating Print
, which is always Null
.
Rather than Print
, save the computed values in an Association
result = <||>;
(* some computation *)
result["NumCardsS"] = numCardsS;
(* some computation *)
result["NumCardsI"] = numCardsI;
(* ... *)
result
Use the debugger. At a point in the code where you want to stop evaluation add
Assert[False]
From the Evaluation menu select Debugger, in the palette make sure "Break at Asserts" is checked. Evaluate the outer expression, when the Assert
is reached the debugger will pause execution and you can look at the values of symbols, step through the code, ... from the debugger palette.