Table of Contents
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)
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.
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.
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
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.
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.