I would like to create a function with several expressions in the code body.
For example, I would like to write something like this, but which will actually work.
myFunction[x]:=
y=x
y=y+3;
(y+3)^3
I know that I can do this :
myFunction[x]:=(y=x;y=y+3;(y+3)^3)
But it will be hardly writable if I have a lot of expression to evaluate.
How can I do it?
(I just installed Mathematica and read some tutorials on the internet so my knowledge is veeeeeery basic).
Module[{y},...]
to makey
a local variable. You can use newlines, they have no syntactical meaning. $\endgroup$myFunction[x]:=Module[{y},y=x;y=y+3;(y+3)^3]
And I can do newline between my ";" ? $\endgroup$Module
(or simply parentheses for that matter) you can use a newline for spacing, but you still need;
(CompoundExpression) or you end up multiplying expressions unintentionally. Please see (41091) for more. $\endgroup$