How do I enter a multi-line expression in the console?
By default, the console lets you enter a single-line expression only; pressing Return simply evaluates this expression.
To enter a multi-line expression, you need to create a new multi-line code block.
To create a multi-line code block, press Shift+Return in the console. (If you do this when the input line contains text, that text becomes the first line of the new multi-line code block.)
Then you can write your multi-line expression the usual way, with Return creating a new line.
To evaluate the code block (to run it), press Ctrl+Return. When the expression has been evaluated, the console returns to single-line input mode.
To discard the current multi-line code block without evaluating it, press Shift+Escape.
The image below shows an example, where a single-line expression has been evaluated, followed by a multi-line expression, and then another single-line expression.
Please note that multi-line code blocks are enclosed by horizontal rules.
While editing a code block (not shown in the image), Ctrl+A selects the entire block, and not the entire console as usual. (And in single-line mode, Ctrl+L selects the entire line.)
Hint: You don’t need to remember the commands Shift+Return, Ctrl+Return, and Shift+Esc, because you find these on the console’s context menu: