I'm using Python in Terminal on Mac OSX latest. When I press enter, it processes the code I've entered, and I am unable to figure out how to add an additional line of code e.g. for a basic loop.
Using a Backslash. The backslash (\) is an escape character that instructs the shell not to interpret the next character. If the next character is a newline, the shell will read the statement as not having reached its end. This allows a statement to span multiple lines.
Those are regular slashes, not backslashes. Actually using a backslash \ instead would work, and you don't need to shift the enter key.
All replies. To enter multiple lines before running any of them, use Shift+Enter or Shift+Return after typing a line.
Printing Newline in Bash Using the backslash character for newline “\n” is the conventional way. However, it's also possible to denote newlines using the “$” sign.
The answer here is far more simple. If you want to continue in the next line after a loop like
while b<1:
when you press enter you get prompted with
...
then you "have to make an indent" by space of tab and only then you can put more code after the three dots like
... (tab or space) print b
then when you press enter the code is not going to be executed but you get another ... where you can keep typing you code by making the new indent
keep the indent the same
that is it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With