I'm trying to print the dimensions of some Vector spaces, but I want to print strings with it so I can read the results more easily. I tried this

n = 0; While[dimF[n] > 0, StringForm["dimH_`1`=`2`", n, dimH[n]]; n++]

But it isn't printing anything.

  • 3
    $\begingroup$ Wrap Print[] around your StringForm[] and see what happens. $\endgroup$
    – Bill
    Aug 18, 2017 at 0:22
  • $\begingroup$ While (and Do, and For) loops in Mathematica don't have an output by default, so you need to either explicitly Print the data (as @Bill) suggested or generally more useful accumulate the data to some list so that you can reference it computationally later (be it with Append, or whatever) $\endgroup$
    – ktm
    Aug 18, 2017 at 2:10
  • 1
    $\begingroup$ André, I think this topic is the answer, what is your opinion? Output of plots from within Do loop $\endgroup$
    – Kuba
    Aug 18, 2017 at 6:30
  • $\begingroup$ Also Echo. $\endgroup$ Aug 18, 2017 at 7:54

1 Answer 1


I solved the problem doing this

n = 0; 
While[dimF[n] > 0,  Print["dimH_", n, "=", dimH[n]]; n++]

Not the answer you're looking for? Browse other questions tagged or ask your own question.