As far as I know shift+enter executes the code whereas plain enter merely goes onto the next line. However, sometimes pressing just enter also runs the code and I cant type onto the next line without starting the code, then going back and pressing enter mid text. What is causing this inconsistency?
2 Answers
Do not type the ENTER key, instead use the RETURN key to go to next line without evaluating.
The ENTER key is the one next to the numbers pad, on the right side of the keyboard.
The ENTER key is the same as hitting SHIFT RETURN.
The RETURN key is normally in the middle of the keyboard.
-
$\begingroup$ Pressing the enter key that is above the shift key SOMETIMES evaluates. I dont know what causes the difference. This starts happening after I have been working on a notebook for a little while. edit: you know what, maybe I was pressing the bottom right enter without even being aware. $\endgroup$ Commented Jul 20, 2020 at 20:42
-
$\begingroup$ @grdgfgr if you do not want to evaluate, then RETURN should be used, not ENTER. This worked for me on standard keyboards. btw, If you use Maple, it is the otherway around. One has to hit SHIFT RETURN to go to next line without evaluating. Very confusing when you use both systems like I do. $\endgroup$– NasserCommented Jul 20, 2020 at 20:46
On my Mac and Mathematica 12.1,
RETURN: goes to a new line in the current cell
OPTION-RETURN: starts a new cell of same style without evaluating the old cell (quite useful with text cells)
DOWN-ARROW: starts a new cell of the INPUT style without evaluating the old cell
SHIFT-RETURN: If in an INPUT cell, starts a new cell after evaluating the current cell. If in a text-type cell, acts like a regular RETURN
ENTER: same as SHIFT-RETURN