Hello World Tutorial
Hello World Tutorial
Tutorial
An introduction to programming with Pascal
This tutorial is to get you started programming with Pascal. By the end of the tutorial you should know how
to run a simple Pascal program. We will run a program which displays Hello World! to the screen. We
will also be using Free Pascal and your computers command prompt; all of which will be explained.
About Pascal
Pascal I is a programming language invented in 1971 by Dr. Niklaus Wirth. Named after the French
mathematician and philosopher Blaise Pascal, it is written to be easy to understand and compile. From the
early 1980s to 1999, Pascal was used in the Computer Science exam portion of the Advanced Placement
exam for high school students. This and the development of the Turbo Pascal compiler helped increase the
popularity of Pascal. Recently, Pascal has lost much of its popularity to the language C++ (which is used by
Windows).
See http://www.taoyue.com/tutorials/pascal/history.html for more on the history of Pascal.
About File Mangers
A file manager is used to organize the files in your computer. Files can be stored in File Folders (think of
the file folders we use to put paper in). File Folders can be stored in other folders, providing even more
levels of organization. For example you might have on your computer several folders named, Work,
School, and Music. In the School folder you could have several more folders named Math,
Science, Reading, etc. and then in the Science folder you might have a bunch of files containing your
papers or reports for your science class. A file manager will often provide multiple ways to navigate and
organize your folders and files.
See http://en.wikipedia.org/wiki/Computer_file_management or http://en.wikipedia.org/wiki/File_manager for more
information on file folders.
About Command Prompts
You can think of a Command Prompt as a way of talking to your computer. You type commands into the
command prompt window as a way of prompting it to do certain things. We will be using the command
prompt to compile and run your program.
For information on command prompts go to
http://kb.iu.edu/data/amog.html
or http://en.wikipedia.org/wiki/Command_Prompt
About Free Pascal
Free Pascal is a free open source compiler for Pascal. Open source means whoever downloads it also has
access to the code which was used to write it. And compiler means it is used to change a programming
language which humans can understand (in this case Pascal), into machine language which the computer can
understand.
See www.freepascal.org/ for more on Free Pascal.
A Free Pascal Manual can be found at http://www.freepascal.org/docs-html/
Getting Ready
This section covers the stuff you will need to download.
Hold the Shift key and right click on any file folder on your computer. If you see the option Open
command window here you do not have to do step 1. This step will make it easier to use the command
prompt. If you do not do step 1, remember to always hold Shift when you right click on a folder to make
the open command window here option appear.
1) Install command prompt here (for windows xp)
b) Using an internet browser, go to
http://windows.microsoft.com/en-US/windows/downloads/windows-xp
(you can click on the link or copy it into the URL bar at the top of an internet browser)
c) click on the Power Toys tab.
d) click on the Open Command Window Here download.
e) Save or run the file. (may automatically save to downloads folder). If a window pops up asking if
you really want to run the executable file, click yes.
f) Run the installation wizard. (click Next repeatedly)
g) After completion. You can now right-click on folders and select the open command window here
option.
2. Download Hello World
a) Download the Hello World program from TurboControl
Go to http://www.turbocontrol.com/helloworld.htm
Click on HelloWorld-fpc-2.4.2.i386-win32.zip
Save in the files in a location of your choice.
b) Unzip the files (see step 3 if you cannot do this step)
Right click on the zipped HelloWorld-fpc-2.4.2.i386-win32.zip folder
Select extract all
Skip this step if no extraction wizard appears. If an extraction wizard appears click Next
through it.
You should see another HelloWorld folder appear (without a zipper). This contains your
extracted files.
3. If you completed step 3, skip this step.
If you are unable to extract the files you will need to download a file extractor.
a) Install from peazip.sourceforge.net/
pas stands for Pascal. This file contains the source code for your
program, written in the Pascal programming language. Source code is the
code from which your program is run. For example
Program hello;
begin
WriteLn;
WriteLn( 'Hello World!');
WriteLn;
End.
is the source code contained in hello.pas, which is the file you compiled for
your HelloWorld program. When you changed the wording in the hello.pas
file, you changed the source code.
app or .exe
.app stands for application and .exe stands for executable. This file
gets run when you type hello in your command prompt.
In the HelloWorld folder:
ppc386.exe is the compiler you used to compile hello.pas.
hello.exe (or hello.app) was created after you compiled the program the
first time, and is the file which gets executed to display Hello World!.
.txt
.o and .ppu