Lesson 3: Escape sequences
What if you want a new line in the middle of a string, or to show a double-quote inside the text? That's what escape sequences are for: a combo that starts with a backslash \ and gives the next character a special meaning. The most useful: \n for a new line, \t for a tab, \" for a double-quote insid
The backslash \ is a magic key: it says 'the next character has a special job'. \n says 'drop a line right here', without splitting into two commands.
- \n
- A new line inside a string — splits the output into two lines.
- \t
- A tab (a wide space) inside a string.
- \"
- A double-quote that appears inside the text itself, without ending the string.
- \\
- A single backslash in the output — because one backslash starts an escape.