2

I am running Julia through (Anaconda) Jupyter notebook. When I run a cell like this

5 + 6
3 + 17

The output is

[out:] 20

How can I print out the output of all lines, i.e.,

[out:] 11

[out:] 20

2 Answers 2

0

But there is only one output of the cell! Expressions have no "output", they have a value. The cell behaves like a block:

output = begin
    5 + 6
    3 + 17
end
show(output)

The expressions in the begin block are sequenced (i.e., evaluated in order, so that their side effects are run), and the end result is then the result of the block. This end result is printed.

If you want to see the intermediate results of the individual expressions, you have to either split the block, or use side effects:

println(5 + 6)
3 + 17
Sign up to request clarification or add additional context in comments.

Comments

0

If you don' t use jupyter notebook' s markdown capabilities you can try my workflow using my branch of julia vscode extension described at Release persist inline results · xgdgsc/julia-vscode. Which shows and persists inline results of every cell line.

This is an alternative workflow for whom suffering from unusable slow long jupyter notebook experience. I prefer this more condensed view of code and results.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.