The New Line Escape Sequence
-
A common escape sequence in computer programming is "\n." When placed within a string of English text in a computer program, the characters "\n" inform the computer that it should insert a new line.
Example
-
For example, consider the following Ruby code:
s = "This is text \n on two lines."
puts s
Output
-
The output for this code will be the following:
This is text
on two lines.
As you can see, the "\n" is removed and the remaining text begins on a new line.
No comments:
Post a Comment