pjhayward's Pascal Tutorial |
|
pjhayward.net Home Got a question? Tutorial Home Preparation Lesson One - Sample Program Lesson Two - Program Structure Lesson Three - Data Types and Constants Lesson Four - Variables Lesson Five - Text I/O Lesson Six - Subroutines Lesson Seven - Conditional Statements Lesson Eight - Arrays Lesson Nine - Loops Lesson Ten - Units | How do you get a newline in Pascal? Well, this is somewhat dependent on whether you're using a DOS/Windows system or a Unix/Linux system, but the basic idea is still the same. In Windows, a newline is marked by two characters, Carriage Return + Line Feed. In *nix, it's marked by a single Line Feed. These are standard ASCII characters, and in programs where I need them a lot, I define some simple global constants, like this: CR = #13; LF = #10; CRLF = CR + LF;Then, whenever I need a newline, I just throw in CRLF, or LF if I'm using Linux. Like this: var somestring; begin somestring:='I want this string to'+CRLF+'use two lines.'; end;It's that easy. Back to Question/Answer list |