but what's the deal with new lines and carriage returns? What's the difference? Is \n\n the equivalent of \r\r or \n\r? Which should I use when I'm creating a line gap between lines?
No one here seemed to actualy answer this question, so here I am.
\r represents 'carriage-return'
\n represents 'line-feed'
The actual reason for them goes back to typewriters. As you typed the 'carriage' would slowly slide, character by character, to the left of the typewriter. When you got to the end of the line you would return the carriage and then go to a new line. To go to the new line, you would flip a lever which fed the lines to the type writer. Thus these actions, combined, were called carriage return line feed. So quite literally:
A line feed,
\n, means moving to the next line.
A carriage return,
\r, means moving the cursor to the beginning of the line.
\n\n doesn't really make sense, nor does
\n\r does I guess but
\r\n is most common. Now, let's move onto computers. The original computers took
\n quite literally.
In this way you could write over characters which were already written. E.G.
Hello\rWorld would look very odd indeed.
Hello\nWorld on the other hand would also look slightly odd...
However these days the support for carriage return is sparse. Usually on every system you can get away with using
\n on its own. It never depends on the OS, but it does depend on what you're viewing the output in.
Still I'd always advise using
\r\n wherever you can!