I have mainly used Jupyter Notebook for playing around with Julia. I’ve seen a couple of references on how to install Jupyter Lab, but haven’t figured out how to do that. In the mean time, I also use Juno occasionally.
I seem to have read that indentation is not needed in Julia, while in Python this is essential. By this, I mean indentation in function blocks, for loop blocks, if statement blocks, etc. But that indentation is recommended for readability. I also seem to have read somewhere that for packages, one should not use indentation.
When I use Juno, the code doesn’t run unless I have indentation. Questions:
- Have I mistaken the indentation rules in Julia?
- If not, why does Juno behave as it does?
Another thing: in MATLAB, line continuation is signaled by ellipsis ("…"), while in Julia, line breaks are supposed to be ok as long as the last character “signals” that the statement is incomplete. In other words, if a line ends with unbalanced parenthesis, that is a signal that the statement continues on the next line. Ending with an operator, e.g., “+”, is a signal that the statement continues on the next line.
I tend to get problems with this in Juno, and it seems like I’m forced to use very long lines and avoid line breaks.
- Is my understanding of line breaks correct?
- If so, why do I get problems in Juno?
- If I use line breaks, is it permittable to use tabulator for the next line so that commands are lined up? In other words:
x = A*x + b
is this allowed? (I’m assuming that the first line is indented in some function block, some for loop, etc.). Or do I have to type:
x = A*x + b