How to input multiple lines in Julia REPL in Windows System, I try to use Ctrl + Enter, but it doesn’t work.
For me, Esc + Enter works
Parentheses help:
julia> (1+2
+3
+4 + 5)
15
But to define a struct
as in the example, you just need to ENTER after each line.
On WIndows you can Shft+Alt+Enter
, it’s the same as Esc+Enter, but I find it more smooth.
Cool!
Very smooth thx. I think Julia vs code should add this shortcut in the official document.
Yes, thx!
I find in vs code, Alt + Enter also works.
Note that the result may not be the same as when using parentheses:
julia> 1+2
+3
+4 + 5
9
while the “correct” result is: 15
Maybe you know but to have addition (or other operations like multiplication) work across multiple lines, the operator needs to be at the end of each line:
julia> 1+2+
+3+
+4 + 5
15
(The reason for the result 9
in the other case is that this is the result of the last line.)
Using parentheses is simpler, as the plus can be anywhere.