Why is it called a newline if it appears at the end of a line?

0
3
Asked By MellowPine42 On

If a newline character is usually written at the end of a line, why is it named "newline" instead of something like "end of line"? Does it actually end the current line, start the next one, or simply act as a boundary between them?

4 Answers

Answered By BrightCedar7 On

It’s best understood as an instruction: “move to a new line.” When text is stored, the character appears after the previous line’s content, but when processed it tells the output device or program where the next line should begin. That’s why it can reasonably be described as both ending one line and starting the next.

Answered By NorthVale_26 On

A newline is also a delimiter between lines, not necessarily a character that belongs exclusively to either side. A trailing newline means the final line is properly terminated, even if there are no more visible characters after it. Many text-processing tools expect files to end that way, and it helps avoid treating the last line as a special case.

Answered By CobaltRiver9 On

Think of it like pressing Enter. You type the text first, then Enter tells the system to continue at the beginning of the next line. Calling it “new line” focuses on where the cursor goes next, while calling it “end of line” would focus on what was just completed. Both descriptions capture part of what happens.

Answered By QuartzMango18 On

The name comes from older printers and teleprinters. A line-feed instruction physically moved the paper down, while a carriage return moved the print position back to the left. Modern systems inherited these terms even though text is usually displayed on a screen now.

SilverKite53 -

That history also explains the different conventions: Unix-like systems generally use LF (n), older Mac systems used CR (r), and Windows commonly uses CR followed by LF (rn).

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.