Basic Pascal Tutorial/Hello, World: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | Hello, World (author: Tao Yue, state: unchanged) | |
| 2 | 2 | ||
| 3 | 3 | In the short history of computer programming, one enduring tradition is that the first program in a new language is a "Hello, world" to the screen. So let's do that. Copy and paste the program below into your IDE or text editor, then compile and run it. | |
| 4 | 4 | ||
| 5 | 5 | If you have no idea how to do this, return to the Table of Contents. Earlier lessons explain what a compiler is, give links to downloadable compilers, and walk you through the installation of an open-source Pascal compiler on Windows. | |
| 6 | 6 | ||
| 7 | 7 | ``` pascal | |
| 8 | 8 | program Hello; | |
| 9 | 9 | begin | |
| 10 | 10 | writeln ('Hello, world.'); | |
| 11 | 11 | end. | |
| 12 | 12 | ``` | |
| 13 | 13 | ||
| 14 | 14 | The output on your screen should look like: | |
| 15 | 15 | ||
| 16 | - | ||
| 16 | + | ```text | |
| 17 | 17 | Hello, world. | |
| 18 | 18 | ``` | |
| 19 | 19 | ||
| 20 | 20 | If you're running the program in an IDE, you may see the program run in a flash, then return to the IDE before you can see what happened. See the bottom of the previous lesson for the reason why. One suggested solution, adding a readln to wait for you to press Enter before ending the program, would alter the "Hello, world" program to become: | |
| 21 | 21 | ||
| 22 | 22 | ``` pascal | |
| 23 | 23 | program Hello; | |
| 24 | 24 | begin | |
| 25 | 25 | writeln ('Hello, world.'); | |
| 26 | 26 | readln; | |
| 27 | 27 | end. | |
| 28 | 28 | ``` | |
| 29 | 29 | ||
| 30 | 30 | --- | |
| 31 | 31 | *From the Free Pascal wiki, page "Basic Pascal Tutorial/Hello, World", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
