Posted on

What is Variable in Programming? Easy Answer!

What is Variable in Programming?

Finally the answer to the question you all wanted to ask me before. What is variable in Programming?. I mentioned before. A Variable is the basic storage unit of almost any coding language there exists. As told above it’s also a important part of Pascal. Variables are super simple to use and need less effort to activate. Still they are very powerful. I’ll explain more below.

As mentioned above variables are not only used within Pascal. But also other coding languages. These data types are what the computer can store within a Pascal Variable. As mentioned before, Variables have a limit. So storing large values within them will give errors. Below is a reason why it is needed.

Uses And Why It is Powerful

As i mentioned above on why they are important. It’s kinda clear that variables are useful in quite a few regards. If you recall previous examples of posts where i show the usage of data types. In most examples i used a variable.

Their ability to store and use data is what shows their true power. Labelling Variables makes calling them a bit easier. I’ll show it with a example below.

Examples Of Variables

An easy example we can take from older posts. Let’s take the example of calling a string.

What is Variable in Programming?

The example shown above is a simple one. Advanced data types call for advanced usage of variables. Which we can discuss at some future post. As mentioned above, variables are very important. Play around with the code a bit. For more, you can also attend this video from SchoolFreeWare on the subject of Variables.

If that example made less sense and this video did not help for some reason. Worry not! the reason i made this was to learn properly. Not to just look at it and call it a day. We will discuss it in far far more detail in the upcoming posts. Just keep the basics in mind. Eventually you might see coding to make more sense than your national language! And that will be funny.

Posted on

What is a real in Pascal? Simple And Easy!

What is a real in Pascal? A real is another basic data type of Object Pascal. It’s main purpose is to store values inside the Computer as an approximation of a Real number. As real numbers are infinite the computer is unable to represent them. Most of the time the computer will use some other method. Such as using rational expressions to represent Real Numbers. Let’s discuss more below!

Usage Of Real Data Type

The Real Data Type is a powerful data type and kind of a stronger version of the Integer and Float data types. Real can hold can store both Integer and Floating point values. Now here i catch you a bit off guard on the part where i said floating point values. Allow me to explain, A floating point is yet another data type of Pascal.

I’ll go into more detail on it in another post for now keep the basic definiton in mind which is as follows:

A floating point is a data type that can store numbers with decimal places or fractions. A real data type is a powerful data type. It can store whole numbers, real numbers and floating point numbers.

Why Use Integer And Floats If Real Is A Thing???

The computer allocates a specific amount of memory for all data types. For example, Take a Floating point as an example. A float can store decimal numbers as well as whole numbers. As mentioned above it can store decimal numbers. Hence the computer allocates more memory to it as compared to the memory it gives to Integers.

As such using Real or Floats as replacements may cause the computer to use excess memory. Causing significant lag. It may make your entire software crash or worse.

That about explains this i hope. I’ll dedicate a whole post regarding Error finding. And more! So worry not if not now then later you will definetly understand!

Example time!

Example Of Real Data Type

Unlike previous posts the Real data type is rather simple. It is almost the same thing as a integer or a floating point value. Instead a simple example can be something like say “3.4” Or 7/8 and so on. It’s the exact same thing as a integer and float combined.

Keep in mind the warning i gave above. Using wrong data types for what they are not meant for will not assist you. Rather it will slow down your progress most of the time.

I recommend watching this short video. From the SchoolFreeWare Youtube to advance your understanding on the subject.

Posted on

What is boolean in Pascal? Surprisingly Easy!

The General Definiton Of Boolean

What is boolean in Pascal? Booleans are the data types of code which represent the values true or false. This data type is also known for its use in logical operators of circuits. That’s more or less related to engineering. But some people among our community might have heard of the Logical Gates. That’s advanced stuff but if you already know what they are, Boy you and i are gonna get along well!

Usage Of Booleans

Booleans hold the values of True and False as written above. As such we can use them in a variety of circuits and complex codes to make life generally a whole lot easier. A example will soon follow but first we have a few key to define about this data type. Considering the fact its powerful it’s got it’s importance like all other data types.


1 – It can only hold True and False. No more, No less. Booleans will give errors when given values of numbers, letters or symbols. Anything other than true and false is wrong within the Boolean data type and wil result in errors.

2 – A Boolean is very hard to use on its own. Rather we can use it to add more power to the existing Strings, Integers and Characters. I’ll explain that below with a example real quick, For now keep these 2 points in mind.

Examples To Use Booleans

The following example is what you can use to see the Boolean data type in action. Note that in this example you may or may not understand some part of the code. Worry not as i mentioned in previous posts. I will explain the parts of the code that you don’t understand in a later post. For now Copy and Paste!

Step 1 – Creating A New Program

For this example we use the free Lazarus IDE. Open up Lazarus and create a new program as shown in the Image Below.

What is boolean in pascal?

Step 2 – Choosing A Program

When clicking the New button, Lazarus will give you a whole lot of software options to choose from and make. As is in previous examples we will use the command line Program to keep things simple and elegant. Select Program from the menu that pops up as shown in the Image below.

What is boolean in pascal?

Step 3 – The Code Itself

After choosing Program and clicking OK the IDE will make a brand new place for you to write the code. Copy and paste what i did as shown in the section below, and once done i’ll explain a bit of the code.

var numbers : integer;
var truth : Boolean;
  numbers := 2;
  if numbers = 1 then
    truth := true;
  writeln('The Program we made told us that if the variable Numbers is equal to 1 then tell us that if its true.');
  writeln('The Program Says That the fact that numbers is equal to 1 is false.');
  writeln('Press <Enter> To Quit The Program');

Slight Explanation On Code

The code i used above is simple. I can explain what it did with a simple sentence. I’ll write it in a normal english sentence as written in the below paragraph.

“Hey Computer i’m declaring 2 variables truth and numbers. Truth is a boolean data type and Numbers is a integer data type. Now give Numbers a value of 1. Now if Numbers is 1 then i want you to declare the boolean data type as True and Print on the screen the message i told you.”

That’s that in a nutshell. It’s fine if you do not understand the code i wrote in the above paragraphs. (Although if you did understand what i wrote, Congrats!). I’ll be sure to answer any questions you may have not only in the comments but also in future posts. For now we move on!

Another Way To Learn

To further improve our understanding on Booleans. I recommend watching a video from Youtube. Posted by a well known content creator named SchoolFreeWare. Use this for further understanding the concepts of Pascal!

Be sure to leave a comment if i left out some minor (or greater!) detail. I’ll be sure to fix it as soon as possible. Not gonna lie it’s fun to have you all to journey with! I hope you feel the same. Moving On!

Posted on

What is Char in Pascal? It’s Surprisingly Simple!

What is Char in Pascal?

What is Char in Pascal? Char is a data type of the Pascal Programming Language. As discussed in my older posts. A Character or Char is one of the basic data types that we use in softwares made by Pascal. Char can store ASCII characters. But it’s not needed to store ASCII characters. Rather it can store about any character provided if it’s only one.

What is ASCII?

ASCII stands for “American Standard Code For Information Interchange”.

All code at its pure, every bit of softwares is only 0s and 1s. Which in coding terms we know as Binary. We use ASCII codes to represent text within a computer in the form of binary 0s and 1s.

But for the data type Char we don’t need to use binary 0s and 1s. An example of Char can be something like “A” or “a”. These both will be treated as Characters (provided you call them the right way!). I’ll show it with a example below.

Personal Opinion

In my personal opinion the Char data type might be a bit hard to understand. But all in all as you progress in this course things will begin to make a whole lot of sense! For now let’s practice calling a Character! Keep the next paragraph in mind : 

A data type is a type. To call it we need to give the computer an item and tell it that “Hey this item i gave you is from now on a Character”. We cannot call the type itself and hope that the computer understands it! As mentioned above i’ll give a example in the next paragraph.


Example Of Characters or Char

For learning purposes, I’ll show you a simple way to assign a Character to a Variable in the below example. Don’t panic i’ll explain what a variable is in a later post. For now here is how we assign a Variable to the data type Character or Char.

As used in all the previous data type posts. To keep things simple we will use the Lazarus software to write the code. And tell the computer to run that code within the command prompt.


Steps Of The Example

Step : 1

Open up Lazarus and on the top right click File. Then click New.


What is Integer in Pascal?

After clicking New a menu shall appear with a variety of softwares that can be made with the Lazarus IDE. In this instance..

Step 2 : Choose the Program application type as shown in the image below.

What is Char in Pascal?
This program will run the code in the command prompt as mentioned above.

Step 3 : Write the code! For this instance we shall declare a Variable to the data type Character and tell the Computer to print out the contents of the Variable onto the command prompt.

program Project1;

{$mode objfpc}{$H+}

  { you can add units after this };
var character : char;
    character := 'B';
    writeln('Press <Enter> To Quit!');

In the Lazarus IDE the first lines which say “uses” or “Classes”. Everything above the line which says “var” is already made for us. So don’t panic on that. Write the code as mentioned above! (You can copy paste it even!).

Step 4 : Run the code! Press F9 on your keyboard in the Lazarus IDE to compile and run the code. The resulting application should be a command prompt. Which says the letter we declared (in this instance B) and the text “Press <Enter> To Quit”.

That is a simple example of Characters Or Char. In the next post i will talk about another data type Booleans. Afterwards once the basics of data types remain taken care of. I’ll explain the Variable thing i did back there. Proceeding on!

Another Way To Learn

As mentioned above, Personally speaking Characters or Char is kinda hard to understand by my perspective. To understand it properly, I recommend not only reading this article but also to watch this video from a famous Youtube channel known as SchoolFreeWare.

Posted on

What is Integer in Pascal? Over Simplified!

What is Integer in Pascal?

Another commonly asked question among the community of Pascal is, “What is Integer in Pascal?” An integer is a Data Type of pascal which can store whole numbers inside it. In an integer, numbers such as 1, 2 , 3 , 4 and 5 and so on can be stored. However, bear in mind that integers can only hold whole numbers.

They cannot hold values such as 1.6 or 1/5 and  so on. Only whole numbers count as such.

Uses Of Integers

As integers can hold whole number values. They are important when it comes to building software related to any sort of calculation. A simple example can be a calculator. A complex example can be the scoreboard (or leaderboard) of a game such as say, Minecraft.

Examples of Integers

Down here i will make a step by step example of integers as well as how to use them. For this purpose we use the Lazarus IDE like the previous example (refer to my post on strings)

The Steps Are As Follows.

Step 1 – Creating A New Program

 Create A New Program by clicking on the File button at the top right corner of the screen in the Lazarus IDE.

What is Integer in Pascal?

Step 2 – Choosing A Program

After clicking the New button, Lazarus will give you a whole lot of options on what kind of applications to build. Navigate your way to Program and click OK.

Step 3 – Writing The Code!

We now have a place to write our code and test it out just like before! Now then, time to write some fancy stuff. Just copy what i do and if you do not understand something, Worry not i shall create more  posts regarding all topics that i know of regarding Pascal.

After all its supposed to be a course, So i will teach you about it soon. For now just copy what i did as shown below.

What is Integer in Pascal? 

Step 4 – Running The Code!

Press F9 on your keyboard, Or Navigate to the top toolbar and click the green play button.

Step 5 – The Finished Result (Good Job!)

The result should look as follows

What is Integer in Pascal? 

Recall step 2. The reason we chose the “Program”  option was so that we could make a simple software. That executes commands within the command prompt to keep things nice and simple. As shown above our code has worked.

What we did was tell the computer this, “Hey computer, Im making a storage area called numbers. I command you to turn it into a integer data type and store the value 12345 in it. Then show it in the Command Prompt.”
If there is anything that i missed out on Integers. Feel free to drop a comment down below, And as for the fact you may not have understood much of my example. Don’t worry it’s there to only show you that integers actually work, I will explain it all in a later post!

Another Way To Learn

As mentioned in an older post, I’ll add a link to a video of a Youtube Channel known as SchoolFreeWare. This channel is amazing at teaching Pascal and can be used to enhance your already existing knowledge of Pascal. 

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!