Ozeki 10 SMS Gateway

Delphi tutorial: Hello world

This tutorial helps you get started with Delphi. It explains what you need to write your first Delphi program. It starts with the basics: you will learn where you can find and download the tools needed, how to install these tools and it will take you all the way to building and runing your code. If you have never written a Delphi program before this is the place to start. We have created this article, so you can get started with Delphi, and move on to our sms examples. If you are already familiar with Delphi, you can jump directly to one of the following SMS projects.

Delphi sms examples:

Delphi send sms with the HTTP rest api (code sample)
Delphi send multiple sms with the HTTP rest api (code sample)
Delphi schedule sms with the HTTP rest api (code sample)
Delphi receive sms with the HTTP rest api (code sample)
Delphi delete sms with the HTTP rest api (code sample)
Download the latest Delphi sms api library from Github

What is Delphi

Delphi is a programming language. It is similar to a natural language, like English. It is used to talk to a computer. The major difference between a natural language and a programming language is that, programming languages have a more rigorous structure, to help the computer understand it better.

What is Delphi Community Edition

Delphi Community Edition is a tool to write a Delphi program. Delphi Community Edition allows you to type in text using the Delphi language, and it makes it possible for you to tell the computer, to read the text and execute the instructions. We use the term "Run" to tell computer to execute the instructions.

What is a Delphi Hello world program

The Delphi hello world program is the most simple program you can write. It simply prints out the sententce: Hello world on the computer screen. The Hello World program is the first program developers write in any programming language.

How to write your first program in Delphi

To write your first program in Delphi:

  1. Setup Delphi Community Edition
  2. Create a new project in Delphi
  3. Select Console Application - Delphi
  4. Write Hello World program in Delphi
  5. Use WriteLn() for printing
  6. Run your Delphi Hello World program
  7. Check the output
  8. Fix the errors if there is any


Here is what you need to get started. To write your first computer program in Delphi, you need a Windows computer, the Delphi Community Edition programming environment and example code presented below.

Download Delphi Community Edition

Delphi Community Edition Community Edition

To get started with coding in Delphi you need to download and install an IDE. You may download Delphi Community Edition from the following URL: https://www.embarcadero.com/products/delphi/starter/free-download/

Install Delphi Community Edition

To write your first Delphi program, you need to install Delphi Community Edition. The following video shows you how this installation can be done.

Create your first Delphi Community Edition project

After Delphi Community Edition has been installed, you need to open it, and create a console project. The console project is the most simple project you can create.

Create new project

To start coding in Delphi you first need to open Delphi Community edition. Then, you need to click on the File tab on the top left (Figure 1). Next, inside the File menu, hover your cursor over New. From New, select Console Application - Delphi by clicking on it. This will bring you straight to the text editor, where you can start coding.

create new project
Figure 1 - Create new project

Write your 'hello world' program in Delphi

The first program you write in any programming language is the 'Hello world' program. The sole aim of this program is to print the term 'Hello world' to the computer screen. In this example the program consists of two lines of code: The first line: WriteLn(); prints the text.

program Project2;


{$R *.res}


    WriteLn('Hello world!');
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);

Run the Delphi 'hello world' program

To run the hello world program, you need to click on the green Start button in the Delphi Community Edition toolbar. You may also use the F5 key to run your program. Note that when you press F9, Delphi Community Edition will first save your newly written file, then it will copmile it to an executable code, and then it will run it on your computer.

Run the program

Now that you wrote your program in the text editor, you can execute it using the IDE. Click on the terminal icon with the green play button next to it in the top toolbar to run your program (Figure 2). Clicking option this button will bring up a debug console and execute your lines of code inside of it.

run the program
Figure 2 - Run the Delphi Hello world program

Output of your code

Once your program ran, you can see the output in the debug console (Figure 3). Here we can see that inside the console, the "Hello World!" message is displayed. This indicates that your program ran as intended. Next, we're going to take a look at what happens when it encounters an error.

Figure 3 - Hello World!

What happens if I make a mistake in Delphi

If you make a mistake, when you write your instructions in Delphi, you will get a Syntax error. The computer will highlight the line with error in red, and it will tell you why didn't it understand the instructions. To correct the mistake you need to go back to the text editor and modify the program. Programs say they "fix the error" when they correct mistakes.

What is syntax error in Delphi?

Syntax error means I don't understand. If you talk to somebody in English and he does not understand what you say, he will reply with "I don't understand". If you talk to a computer in Delphi and the computer does not understand what you say, he will reply with "Syntax error".

In the code below we will create a mistake intentionally by not putting a semicolon after the Hello World line. You will see, how the computer reacts, how we fix the error, and how we run the computer program successfully.

How to handle a syntax error in Delphi?

In the code below we will create a syntax error intentionally by not putting a semicolon after the Hello World line. You will see, how the computer reacts, how we fix the error, and how we run the computer program successfully.


If your code fails to run for some reason, an error message pops up in a new window (Figure 4). This window notifies the developer of the error, as well as provides information about the nature of the error. This way it is easier for the programer to identify mistakes in the code and fix them.

Figure 4 - Error


By reading this article, you have obtained valuable information on how to get ready for coding in Delphi and how to build and run your first Hello World code. If you have followed the instructions above and successfully welcomed the World, you have made your first step in becoming a Delphi software developer. Now you can use the Ozeki Delphi SMS solutions which will help you in message organization very effectively, because you can customize the given codes without any limitations.

Learn more about developing your messaging system by using Delphi solutions. Move on to the next tutorial about how to send SMS from Delphi.

Download the Ozeki SMS Gateway now and put into practice what you have learned!

More information