Posted on

What is a Pascal String? It’s Simple!

What is a Pascal String?

Basic Definition:

What is a Pascal String? A very frequently asked question among the pascal community. A string is basically a data type to define any form of text.

The “String” data type is excellent for basic data storage within code. You can make a simple Hello World program with it without needing any other data type!

Detailed Information On Strings:

Anyways, with that in mind back to topic!

A string is not only a data type in the pascal programming language. but is also a data type for the majority of the famous languages out there such as the famous language Python. To use a string we use quotation marks to tell the computer that this is a string or text.
An example can be “Hello World!” or “Hi I am John”. Strings can also store numbers but keep in mind that the computer will treat it as if its text not a number.  For numbers we use another data type! Which we will discuss in later posts. For now keep the strings in mind.
There can be many examples to strings, we can also create an easy program with it. For example reasons. I will make a small program down below to print out the words ‘Hello World!’ to the screen. By using Pascal in the Lazarus IDE. (i will explain IDEs and Lazarus in a upcoming post so dont worry this is only a example to show the power of Pascal).

 

An Example Of Hello World

Step 1 – Making A New Program

For this example in the Lazarus IDE we first create a new program:

Step 2 – Creating A Program

Click the New button and a menu will pop up, showing a list of different programs you can make in the Lazarus IDE. For this example we use a Program which is a simple application that functions by executing commands in the command prompt (or command line).

Stem 3 – The Code Itself!

Now that that is set, The IDE will make a menu where we can write all the code and stuff. In this case write down the following code and run it.

Running The Code

To run the code in the Lazarus IDE. Press the F9 key on your keyboard. Or go to the top right corner of your screen to find a green Play button, click that to run the code.

Sometimes, when you run the code. It will say something like “This project does not write debug info in Dwarf format”. It will give you 4 options to choose from. Click the first one which says “Enable Dwarf With 2 Sets.” and it will run the code fine.
The result will be the Command Prompt saying ‘Hello World!’. Some may have noticed us using ” to write our string. These mini quotations are what we use to call a string in the Pascal language.

Another Way To Learn

Other than reading these articles to learn Pascal, there is also a famous youtube channel by the name of School Free Ware. The content creator there posts incredibly detailed and simple Pascal videos. For further understanding of this article as well as just to improve your knowledge it’s my recommendation to check out this video below: 

I will post this video with all relevant posts of mine regarding the video itself. Moving On!