ArticleslgStudy

science

Newline

Newline is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Newline rather than just read about it. In short: A newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. A newline is used to signify the end of a line of text and the start of a new one.

Newline — main illustration
Newline — illustration

Key takeaways

  • Newline belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Newline to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Newline from memory before moving on to harder problems.

Reference excerpt

A newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. A newline is used to signify the end of a line of text and the start of a new one.

History

In the mid-1800s, long before the advent of teleprinters and teletype machines, Morse code operators or telegraphists invented and used Morse code prosigns to encode white space text formatting in formal written text messages. In particular, the Morse prosign BT (mnemonic break text), represented by the concatenation of literal textual Morse codes "B" and "T" characters, sent without the normal inter-character spacing, is used in Morse code to encode and indicate a new line or new section in a formal text message. Later, in the age of modern teleprinters, standardized character set control codes were developed to aid in white space text formatting. ASCII was developed simultaneously by the International Organization for Standardization (ISO) and the American Standards Association (ASA), the latter being the predecessor organization to American National Standards Institute (ANSI). During the period of 1963 to 1968, the ISO draft standards supported the use of either carriage return plus line feed (CR+LF) or LF alone as a newline, while the ASA drafts supported only CR+LF. The sequence CR+LF was commonly used on many early computer systems that had adopted Teletype machines—typically a Teletype Model 33 ASR—as a console device, because this sequence was required to position those printers at the start of a new line. The separation of newline into two functions concealed the fact that the print head could not return from the far right to the beginning of the next line in time to print the next character. Any character printed after a CR would often print as a smudge in the middle of the page while the print head was still moving the carriage back to the first position. "The solution was to make the newline two characters: CR to move the carriage to column one, and LF to move the paper up." In fact, it was often necessary to send extra padding characters—extraneous CRs or NULs—which are ignored but give the print head time to move to the left margin. Many early video displays also required multiple character times to scroll the display. On such systems, applications had to talk directly to the Teletype machine and follow its conventions since the concept of device drivers hiding such hardware details from the application was not yet well developed. Therefore, text was routinely composed to satisfy the needs of Teletype machines. Most minicomputer systems from DEC used this convention. CP/M also used it in order to print on the same terminals that minicomputers used. From there MS-DOS (1981) adopted CP/M's CR+LF in order to be compatible, and this convention was inherited by Microsoft's later Windows operating system. The Multics operating system began development in 1964 and used LF alone as its newline. Multics used a device driver to translate this character to whatever sequence a printer needed (including extra padding characters), and the single byte was more convenient for programming. What seems like a more obvious choice – CR – was not used, as CR provided the useful function of overprinting one line with another to create boldface, underscore and strikethrough effects. Perhaps more importantly, the use of LF alone as a line terminator had already been incorporated into drafts of the eventual ISO/IEC 646 standard. Unix followed the Multics practice, and later Unix-like systems followed Unix. This created conflicts between Windows and Unix-like operating systems, whereby files composed on one operating system could not be properly formatted or interpreted by another operating system (for example a UNIX shell script written in a Windows text editor like Notepad).

Representation Earlier history in Telegraphy and typewriters generally considered starting a new line a single action, and it would make sense to encode it as a single control character. However, the design of printing teletypes led to the idea of a newline being two actions, a carriage return CR and line feed LF. A CR by itself was useful to overprint the current line to make double-struck bold or underscores. A LF going straight down was mechanically simpler and could print some text faster if there was a working backspace. Requiring two characters to start a line did not waste any time as the mechanisms were slower than the time it took to send both of them (often extra "padding" characters had to be sent to be sure the carriage had reached the left before the next printing character). The CR was always sent first as it was the slow one. If software did not want to process the characters before sending them to a teletype, this meant that each newline had to be stored as the CR+LF pair or CRLF, on paper tape or in text files. Often the "padding" characters had to be stored as well. Making newline be a single character just like space is helpful for text processing and pattern matching, and made the files smaller. Some systems did require LF to go to the left edge and many terminals had a configuration option to allow this (though this broke too much software that relied on LF going straight down). Multics and thus Unix instead required processing, a LF sent to a terminal was replaced by the operating system with CRLF (or whatever the terminal needed including padding characters).

… excerpt ends here. Continue reading the full article.

Illustrations

Newline: A newline inserted between the words "Hello" and "world"
A newline inserted between the words "Hello" and "world"
Newline: A text file created with gedit and viewed with a hex editor. Besides the text objects, there are only EOL markers with the hexadecimal value 0A.
A text file created with gedit and viewed with a hex editor. Besides the text objects, there are only EOL markers with the hexadecimal value 0A.

Worked examples

Example 1 — a first encounter with Newline

Start with the simplest possible case. Write down what Newline claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Newline before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Newline ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Newline

In research
Newline appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Newline in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Newline is common in secondary-school and first-year university syllabi. It links to neighbouring topics Control characters, Programming language comparisons, Whitespace, so understanding it makes those chapters shorter.
In everyday life
Look for Newline outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Newline” →

How to study Newline in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Newline means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Newline out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Newline in simple terms?

A newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. A newline is used to signify the end of a line of text and the start of a ne…

Why does Newline matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Newline?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Newline.

Tags

  • Control characters
  • Programming language comparisons
  • Whitespace

Keep exploring