Blog Series Focused on Smoothing the Transition from Python to Object Pascal

Blog 1: What is Python, Object-Oriented Pascal and their differences

Hello there, dear reader, and welcome to our blog series discussing the differences between Python and Object Oriented Pascal. 

Who is this blog for?
Python syntax example showing how different it is from Object Pascal
Example of Python syntax

Chances are that, if you came across this article, you already or are looking to get into developing your applications with the help of Object Pascal, perhaps, through the use of Delphi as your IDE of choice. Majority of beginner and intermediate developers, including myself, in the current age of the industry, started their journey with Python.

For those who do not know or remember, Python is a high-level, general-purpose programming language. The reason why the most of developers start their learning with it is very obvious. Python is easily readable and has a simple structure. It has almost no coding formalities that many of other languages require to keep in mind. Even though Python by itself is a very powerful, back-end language, that can be used to develop some highly advanced programs and algorithms (for example, Blockchain), relying solely on Python in order to develop interactive applications with elements of GUI can be challenging for developers of any level. That is why programmers seek to work in some sort of IDEs that make that job easier for them.

One of such IDEs is RAD Studio, however, the programming language that is used there is Object-Oriented Pascal. Unlike Python, Object-Oriented Pascal is not as readable as Python, which scares new comers. Sounds familiar to you? No worries! Follow along with this blog series, and the transition to Object-Oriented Pascal will be smooth and simple for you!

Object-Oriented Pascal, what is that?

It is important to mention that Python is also an object-oriented programming language, everything apart from control flow in Python is an object. The reason why we refer to Pascal as “Object Oriented Pascal”, is because the first-comer, original Pascal, is not object oriented, meaning that it does not have programming features such as classes and methods. They had to be created manually through hard code, prior to you being able to refer to them in your code. It also did not include some of the main aspects of OOP (object-oriented programming) such as inheritance, however, we will not dive into that just yet. So what is the definition of Pascal then? To put it simply, it is a primitive, user-friendly, imperative, procedural programming language. To state the one main advantage and disadvantage of Pascal when compared to python, is that:

+) Object Pascal is much faster, has lower memory size, and can be compiled into an executable file quite easily

-) It is not as covered by the tutorials, documentation and any other guidance on the World-Wide Web. Pascal is simply not as popular as Python, and for that reason, unfortunately, the majority of new developers stay away from it, as if it is an extremely dense, unknown forest.

If you are a true programmer and have the appropriate mentality, you understand that technical superiority is the key in this case, and the challenge of learning it, should be only seen as a positive personal quest, rather than a threat. So let’s examine some essential and basic differences between the two languages’ notation. 

Structure of The Code

If you have ever written code in Python, you know that the code can be as chaotic as you would like it to be. Apart from the essential rule of reference (you have to declare the variable or function before you can refer to it), there are no constraints on what your code’s structure. In our case, Object Pascal has some basic structure necessary for the code to work. Let’s see if you can spot it yourself, by comparing the two codes:


print(‘Hey there!’)



Write(‘Hey there!’);


The difference is quite apparent. For Pascal, it is necessary to include the code you want your program to execute between the main Begin and End (referred to as ‘main’, because later on you will see that more ‘local’ begin-end pairs may be used in your code). That is the first difference worth mentioning. If you are proactive you also picked up on the different function syntax to display a statement. Also, notice the necessity to use “;” after a line of code, this is one of such coding formalities, we have mentioned before.  

The second difference that is a must-mention, is how you declare the variable. In Python, it is more than sufficient to declare the variable like this:

word = ‘simple’

In Pascal, on the other hand, the process is a bit more complicated. You first have to declare the type of the variable in the “var” section, prior to the main Begin, and only then you can assign the value to that variable: 


phrase: string;


phrase := ‘not so simple’;


Moreover, notice the difference in notation used when assigning a value to the variable. In Python, we use a simple equality sign – ‘=’; in Pascal we need to use ‘:’ to declare the type of the variable, and later on to assign the value, we use ‘:=’. You might ask yourself, why go through such a hussle when it comes to declaring the variable. The major benefit of this approach is the functional simplicity when it comes to compiling your code. The program, in Pascal, can track what is the value of a variable easier, while in Python, the program takes time to verify what type the object is at any particular moment, as you could have mutated a string to be an integer, then a string and then an integer again! 

Let’s Sum Up What We Learnt So Far

See, Pascal is not so complicated! It will just take some time and practice to get the hang of it, but no worries, our blogs will help you with that. In today’s blog, we covered the overview of both languages, the basis of the code structure and how to declare variables. Stay tuned for more blog posts, where we will dive full on into more advanced methods and elements of coding in Pascal in comparison to Python, by always checking out our blog page!

We are using cookies on our website

We use cookies to ensure that we give you the best experience on our website and to analyze our traffic. For more information on how we use cookies, please visit our Privacy Statement.
By using our website, you acknowledge this notice of our cookie practices.