what is backslash n encoding backslash n
is referred to as a newline character
it is part of a group of special
characters called escape sequences and
is used in many programming languages
such as c plus plus java and python
as the name implies the newline
character is used within string literals
to implement a new line
for example if i print hello world with
a backslash n between hello and world
here's what the output will show
here what is happening is the
interpreter will print hello
then execute this escape sequence to
move the cursor to the next line
then print world
the new line character is commonly used
within shorter string literal text to
add new lines
however there are situations where many
lines of text are needed to be added for
example to print a paragraph of text
in situations like this rather than
using a single line string literal and
adding backslash n throughout the
paragraph
it would improve readability and be
easier to use a multi-line string
multi-line strings are made using triple
single quotes or triple double quotes
around the text
in multi-line strings
the text is printed exactly as shown
without the need for the new line
character
notice here the improvement in visibly
comprehending this paragraph of text
compared to using the single line string
literal
this completes the topic of the new line
character and the alternative multi-line
option
if this video was helpful to you please
leave a like to show your support if you
have any questions or suggestions leave
a comment thanks for watching