Code, Archeology, and Line Breaks

Did you know \r and \n are remnants of typewriters?

Donovan So
Better Programming
Published in
4 min readDec 29, 2020

--

Typewriter
Photo by Bernard Hermant on Unsplash.

Have you ever wondered how a new line is stored on a computer? You know, what happens when you hit “enter” in a text editor?

On Windows, a new line is stored as the weird sequence \r\n. For example, the following text:

Hello
World!

--

--