I would like to know what is the difference between chr(10) linefeed and chr(13) carriege return if both can do the same thing

If need to break a line I can use chr(10) or chr(13), both do the same, but what is the real difference between them. Sometimes I see both being used chr(10) + chr(13)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chr(13) means CR (Carriage Return).
Chr(10) means LF (Line Feed).

The difference:
CR - signals "carriage return" (put the cursor in the beginning of the line).
LF - signals "line feed" (put cursor on a new line).

Some encoding tables treat both chars the same way (like "new line"), some differently.

For example in TMemo, each time when you do Memo1.Lines.Add('some text'); to the end of "some text" two chars (CR and LF) are added, so you get "some text" + #13 + #10.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Initially, CR and LF were command characters used to control cursor position in some old PCs/Terminals and Printers.

Some are frequently used in text; for example LF (line feed) which is 0x0A (which causes a printer or display to move down one line), and CR (carriage return) which is 0x0D (which often causes a printer or display to move down one line and to the left hand side).
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Also from

<cr>Carriage return is to return the cursor or current active display location for the next character to the beginning of the same line.

<lf>Line feed is to change the display location right below the current position, or in other words, go to the next line below.

So in programs such as notpad which do not allow the cursor to go 'anywhere' {there must be a technical term for this but i do not know it} as in the Delphi Code editor Line feed and Carriage return appear to do the same thing.

hidrauAuthor Commented:
Thanks for everybody
Thanks for the Points
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.