Your First Delphi 7 Program
We will use Delphi to create a simple program and run it.
The programming culture demands that the first program written in any language should output "Hello World!" to the screen. The steps to do this are as follows:
- Start Delphi by double-clicking on its Launch icon.
On the menu bar click on File then New:
Click on Other ...:
Double click on Console Application.
The editor window appears.
On file menu, click on Save and save the program in a suitable folder as HelloWorld.dpr.
The program name should change in the editor window:
Delete the line between begin and end then type the lines writeln('Hello World!');
followed by readln;
in their place.
Your first program should look like this:
- Carefully check that every character is correct. Especially check that the single quotes and the semi-colons are there.
The time has come to compile and run the program! Press the green triangle near the top left of the Delphi menu bar, OR press the F9 key.
In case you were wondering, the file will be saved automatically, so you do not need to save it first.
After a small delay, you should see a mainly black window appear with the output in the top left:
If it did not work, you will need to check again for errors, and correct them before clicking on the run icon again.
- Carefully check that every character is correct.
- Especially check that the single quotes and the semi-colons are there.
If it did work, you should notice:
The green start icon has now changed to grey, indicating that the program is still running, and that consequently the icon is inactive.
There is a blinking white cursor (a horizontal bar) on the black window, indicating that the program is awaiting input (due to the readln; statement).
- Press the Return key again, to make the program terminate.
New console program opened
Text denoted by single quotes
Text output to screen
If you want to, you can quit from Delphi by selecting menu item
Alternatively, you can move on to another topic.