Variable output in Pluto Notebook

Viewed 735

enter image description here

I'm in the process of working on a coding project in a pluto notebook. It's early days but I'm curious why the value of 1000 doesn't show beside quadorder in the screenshot above. It seems to output for everything else!

1 Answers

It is the ; in your code that triggers that. However, I don't think it is supposed to be expected behavior. It is supposed to be a comment, but the parser probably sees the ; and thinks that it is part of the code. If you put it between quoting marks then this doesn't happen. I.e. this should work as expected:

quadorder = 1000 # like python Julia doesn't require ';'

Otherwise, it would usually also work if you just don't put it at the end of the line.

The Julia REPL evaluates the semicolon wrongly and it is a know issue github.com/JuliaLang/julia/issues/28743. You can actually trick it into some weird behavior that suppresses output. For example this returns no output:

julia> ";#"

julia> a = [";   #", "hi", 3]

julia> a = "223" #;

The reason is that the REPL parser looks for the last semicolon in the line and if there is any # or if it is at the end of the line (whitespaces don't matter), then it suppresses any output.

Related