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.