Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run my Mathematica scripts from the terminal and I want it to print lines like MATLAB would. That is, suppress output by ending a line with ;, and otherwise print the output of the line. Get (<<) only prints the last line.

Without using Print[var] and saving variables after every line... Is this possible?

share|improve this question
Your scripts ought to have Print[] lines somewhere in the file, then... – J. M. Oct 31 '12 at 12:50
"...without using Print[var]..." - why? – J. M. Oct 31 '12 at 14:42
I think adding // Print after every line is the best I can do, saves me from having to Print specific variables... – user1788553 Oct 31 '12 at 14:43
without using Print[var] because I don't want to have to put in specific variables, I want a general solution... – user1788553 Oct 31 '12 at 14:43
In that case, I suppose postfix application of Print[] is what you want, indeed. – J. M. Oct 31 '12 at 14:45

You print by having a Print[] on the expression you want to print. End all other statements with ;.

fooToPrint = bar[...]; Print[fooToPrint];  
fooNoPrint = bar[...];


a = 1 + 2;

b = 3 + 4;

a = b;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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