I want to break an expression over multiple lines in Mathematica. How do I accomplish this?
I want multiple lines for readability, but they should have no impact on evaluation.
Some of my (failed) attempts:
In[1]:= 2
+3
Out[1]= 2
Out[2]= 3
In[1]:= 2\[NewLine]+3
Out[1]= 2
Out[2]= 3
In[1]:= 2\
+3
Out[1]= 6
(Is the third usage a bug? It is multiplying the numbers.)
This works, but is ugly and undesirable:
In[1]:= 2(*
*)+ 3
Out[1]= 5
Use an unmatched parenthesis to continue your input on subsequent lines:
In[1]:= (2
+3)
Out[1]= 5
Or, try moving the operator to the preceding line, as MMA will expect the next line to be a continuation:
In[1]:= 2+
3
Out[1]= 5