Contents:

How to quickly make money in IT in 2025 Try yourself in different areas of IT and take the first step to a new profession remotely!
Find out moreWhat is Pascal
Pascal is a procedural programming language named Pascal is named after the French mathematician and physicist Blaise Pascal. It was developed to teach students the basics of structured programming. However, thanks to its simplicity and efficiency, Pascal quickly became one of the most popular programming languages by the end of the 20th century. The language allows for the easy creation of structured and readable programs, making it an ideal tool for both beginners and professional developers. Currently, Pascal is used in educational institutions and some commercial projects, confirming its relevance and value in the programming world.
The Pascal programming language was developed by Niklaus Wirth, a renowned programmer and computer scientist. The idea for Pascal came to him while working on the Algol 60 language, which was widely popular at the time. Wirth, together with his colleagues, sought to improve Algol, making it simpler, more concise, and more functional. The result of these efforts was the Algol W dialect, which later became the basis for the Pascal language. For more information about the creation of Pascal and Niklaus Wirth's contribution to the development of programming languages, visit our article about him.

Read also:
Niklaus Wirth — A distinguished scientist and programmer, best known as the creator of the Pascal programming language. Developed in 1970, this language became the foundation for teaching programming and had a significant influence on the development of other languages. However, Wirth's achievements were not limited to Pascal. He also developed a number of other languages and systems, such as Modula-2 and Oberon, which contributed to the refinement of programming concepts and system design. Wirth was actively involved in software engineering and programming language theory, making his contributions to this field invaluable. His work continues to inspire new programmers and researchers, and the ideas behind Pascal and other languages remain relevant today. One of the main goals of developing the Pascal programming language was to teach students the fundamentals of programming. To achieve this, all unnecessary elements were removed from the complex syntax of the Algol language, significantly simplifying the learning process and lowering the entry barrier for beginners. This approach made Pascal an ideal tool for teaching programming, as it allows one to focus on the logic and structure of code rather than the complexities of syntax.
The main features of the programming language include its syntax, which ensures readability and ease of writing. Another important aspect is its support for various programming paradigms, such as object-oriented and functional programming. A powerful standard library provides developers with an extensive toolkit for solving problems. In addition, the language has an active community, which facilitates quick assistance and the exchange of experience. The presence of numerous frameworks and development tools significantly speeds up the process of creating applications. These characteristics make the language popular among developers and in demand in various areas of programming.
- Simple syntax. Non-obvious code formatting rules were removed from ALGOL, and the constructs of for, if, and while statements now take fewer lines.
- Strong typing. ALGOL had a powerful system for working with data types, but it was difficult for a beginner to understand. Therefore, Wirth chose strong typing for Pascal, where all variables, functions, and parameters must be declared with an explicit type.
- Strict control structure. Programs could create new functions using data obtained during code execution. This feature was removed from Pascal to simplify the logic.
- Sets. Wirth added support for sets to Pascal—collections of unique symbols that can be combined with each other and find intersections. Today, sets are found in many programming languages, but in 1970, they were a groundbreaking tool.
- Limited nesting. In Algol, it was possible to use deeply nested blocks of code. This is convenient for developing large and complex projects, but the feature is practically useless in educational scripts. Therefore, it was also not included in Pascal.
- Data structures. Pascal introduced the ability to combine different data types into a single structure. Wirth introduced the record keyword to denote them. Later, this concept was adapted for C/C++.
Over 20 years, Pascal has become one of the most popular algorithmic programming languages. Leading technology companies began developing their own versions of compilers and implementations of Pascal, introducing functionality into the language not provided in the original version. As a result, versions such as Object Pascal, Turbo Pascal, Free Pascal, PascalABC.NET, and Delphi appeared. These extensions significantly increased the capabilities of the language and made it more flexible for software development.
What is Pascal Used For?
Pascal was developed by Niklaus Wirth as a language for teaching the basics of structured programming and remains popular in this role to this day. It is actively used in educational institutions around the world, including schools and universities, where it is used to create code examples and problems for state exams. In Russia, for example, the Basic State Exam (BSE) requires schoolchildren to analyze program code written in Pascal, emphasizing its importance in the educational process.
Today, the Pascal programming language is not used to create services and applications used daily by millions of users. Developers prefer more modern and versatile languages such as Java, Python, and JavaScript, which offer high execution speed and development flexibility. These languages provide a wider range of features and tools for creating efficient and scalable solutions.
In the past, the Pascal programming language was used not only by hobbyists but also by large companies. One notable example is the operating system for the Apple Lisa computer, for which Apple engineers created Object Pascal in the 1980s. This object-oriented version of the programming language became the basis for many of the company's projects and remained in use until the mid-1990s. Pascal and its derivatives had a significant influence on the development of software and technology during this time.

If you're an experienced Windows user, you're probably already familiar with the Total Commander file manager. This tool remains popular due to its functionality and ease of use. Many of its components and modules are still developed in Pascal, underscoring the program's reliability and stability. Total Commander offers a variety of features for effective file management, including support for various plugins and advanced functions, making it an indispensable tool for advanced users.

Read also:
Windows and macOS: Developers' Opinions About Popular Operating Systems
Developers often express their opinions about Windows and macOS, highlighting both the advantages and disadvantages of these operating systems. Windows, being the most widely used OS, offers extensive customization options and compatibility with various software. This makes it attractive to developers working on a variety of projects. However, frequent updates and security issues can be a source of concern.
On the other hand, macOS is renowned for its stability and high performance, making it the preferred choice for many professionals, especially in the fields of design and app development. The intuitive interface and integration with other Apple products are also significant advantages. However, limited compatibility with some programs and hardware can be a barrier for developers working with certain technologies.
Thus, the choice between Windows and macOS depends on the specific needs and preferences of developers. Each system has its own strengths and weaknesses, and understanding these aspects will help you make an informed choice.
The TeX typesetting system was developed by the eminent computer scientist Donald Knuth, who chose the Pascal programming language as its basis. One of the most famous implementations of TeX is LaTeX, which continues to find wide use in the scientific community. LaTeX is ideal for formatting mathematical formulas and complex text, making it a popular tool for writing scientific articles and publications, including materials on platforms such as Wikipedia. LaTeX provides high-quality layout and ease of working with formulas, making it indispensable for many researchers and authors.
The Delphi programming language, based on the object-oriented version of Object Pascal, is used to develop many software solutions. It became the basis for such popular applications as Skype, as well as early versions of the Unreal Engine game engine. In addition, Delphi was used to develop the WinRAR archiver and the FL Studio digital music workstation. It's also worth noting that some macOS modules were created using this language. Delphi continues to be a relevant tool for developers due to its flexibility and powerful capabilities.
Pascal Implementations
The creation of the Pascal language, initiated by Niklaus Wirth, generated great interest not only among students but also in the programming community. This led to the development of various Pascal implementations, which added new features and capabilities. Let's consider the most popular dialects and programming languages based on Pascal, which continue to be used in software development.
In 1986, a team of engineers led by Larry Tesler created an object-oriented version of the Pascal language for Apple, known as Object Pascal. This programming language introduced concepts such as classes, objects, and inheritance, significantly expanding developer capabilities. In particular, it allowed for code reuse, eliminating the need for programmers to constantly rewrite functionality. Object Pascal was an important step in the evolution of programming languages, providing more efficient software development methods.
The programming language has gained wide applicability in large projects due to its flexibility and extensibility. Over time, its functionality has been significantly improved by various companies. In particular, Borland engineers introduced dynamic typing, which allows the same variable to accept different data types in different parts of a program. This feature makes the language more versatile and convenient for developers, contributing to the creation of more complex and scalable applications.

Study additional materials:
Objects and classes in object-oriented programming (OOP) are fundamental concepts that allow you to organize your code in a more structured and understandable way. Classes serve as templates for creating objects, which represent specific instances of those classes. Each object can have its own unique properties and methods defined in the class.
Classes allow you to group data and actions that can be performed on this data, which promotes encapsulation and code reuse. With classes, you can create hierarchies using inheritance, which allows you to create new classes based on existing ones, while improving their functionality and reducing the amount of repetitive code.
Understanding objects and classes is an important step in mastering OOP and helps developers create more flexible and maintainable applications. Learning these concepts will open new horizons in programming and allow you to effectively solve problems of varying complexity.
Turbo Pascal is a development environment and a dialect of the Pascal language that was used to create software. The name "Turbo" is due to the high speed of code compilation. Unlike traditional compilers that process code multiple times, Turbo Pascal allows for single compilation, resulting in rapid executable generation. This dialect was designed for use on resource-constrained systems, allowing the compiler to efficiently utilize the computer's memory and processor. Turbo Pascal has become a popular tool for programmers due to its simplicity and high performance, which contributed to its spread in educational institutions and among novice developers.

Reworked text:
Learn more Materials:
A compiler is a specialized program that translates source code written in a programming language into machine code that can be executed by a computer. The compilation process includes several stages: source code analysis, optimization, and executable file generation.
In the first stage, the compiler analyzes the syntax and semantics of the code, identifying errors and checking for compliance with language rules. Then, optimization occurs, improving the performance of the code, making it more efficient. Ultimately, the compiler generates an executable file that can run on the target platform.
Compilers can vary in their functions and features. Some support different programming languages, while others may be specialized for a specific language. Using a compiler allows developers to create high-performance applications, since compiled code executes faster than interpreted code.
The importance of compilers in modern programming is difficult to overestimate, as they play a key role in software development. Compilers enable developers to create complex and efficient programs that run on a variety of devices and platforms.
Borland engineers developed the implementation based on UCSD Pascal, which was used on Apple II computers. This approach created an efficient and functional programming environment, providing users with access to powerful software development tools.
In 1997, Free Pascal, an open-source implementation of Pascal, was released. It retained the simplicity of the classic version of the language and added object-oriented programming capabilities. Free Pascal's openness became a key advantage for the community, as it made it possible to port the language to various platforms and operating systems. Currently, Free Pascal supports over 30 platforms, including Windows, Linux, macOS, Android, MS-DOS, FreeBSD, Game Boy Advance, and Nintendo DS. This makes Free Pascal a versatile tool for developing software in various environments.
Delphi is a programming language developed by Borland, which is an evolution of Object Pascal. It was created to simplify the development of full-featured applications for personal computers. Delphi integrates powerful libraries for creating graphical interfaces, as well as tools for efficiently working with databases. This programming language is widely used in various fields, including the creation of desktop applications, business solutions, and data management systems, due to its simplicity and high performance.
Delphi, unlike Pascal, offers the ability to compile cross-platform applications for operating systems such as Windows, macOS, Linux, Android, and iOS. The Delphi programming language supports significantly more libraries, which simplifies application development, including tools for working with networks and graphics. This makes Delphi an ideal choice for developers seeking to create versatile, high-quality software solutions.
In 2007, Southern Federal University (SFedU) in Rostov-on-Don introduced PascalABC.NET, a unique implementation of the Pascal programming language. This project combines the functionality of Delphi and includes its own modules, as well as support for the .NET platform. PascalABC.NET is focused on teaching programming and offers users modern development tools, making it an ideal choice for students and novice programmers.
Why Pascal is Still Used to Teach Schoolchildren
More than 50 years have passed since the release of the Pascal programming language, and during this time it has become the basis for training many generations of developers. Despite the emergence of more modern languages, Pascal is still actively used in educational institutions, including schools and junior colleges. This is due to several factors.
Firstly, Pascal has a clear and understandable syntax, making it ideal for beginning programmers. Secondly, it helps develop logical thinking and algorithmic programming skills. Finally, its simplicity and structure allow teachers to effectively explain basic programming concepts, which promotes a deeper understanding of the subject.
Thus, despite the development of technology, Pascal remains a relevant tool for teaching the basics of programming.
Pascal's syntax is simple, making it easy to write and read code. This allows beginning developers to focus on solving problems rather than overcoming the difficulties associated with the language's complexity. Using Pascal promotes rapid mastery of programming fundamentals, making it an excellent choice for those just starting their development journey.
Structured programming in Pascal. Programs written in Pascal are organized into code blocks, which helps students master the strict structure of program writing. Let's look at an example in which a program includes two blocks of code: the main program block and the PrintNumbers procedure. This approach develops code organization and logical thinking skills, which are important aspects in learning programming.
Programming safety in Pascal is ensured by strong typing, which prevents errors from occurring during program execution. If the variable types do not match the specified values, the compiler will detect the error and will not allow the developer to make critical mistakes. This makes Pascal a reliable choice for creating stable and secure applications.
Smooth transition. The Pascal programming language includes all the fundamental elements found in modern languages such as Python, Java, and C++. Developers who have mastered Pascal can easily transition to any of these languages, learning only their unique features. This does not require re-familiarization with basic programming concepts, which significantly simplifies the process of adapting to new language environments.
A program for displaying numbers on the screen can be implemented in different programming languages, such as Pascal and Java. Despite differences in syntax, the basic principles remain the same. Both languages use variables, loops, and commands for displaying data on the screen. These elements form the foundation of programming and allow for the construction of efficient algorithms. Learning these principles helps developers easily transition from one language to another while maintaining an understanding of programming logic.
Pascal is a high-level programming language that was developed in the early 1970s by Niklaus Wirth. It was named after the French mathematician and philosopher Blaise Pascal. Pascal was originally created to teach and popularize structured programming, making it an excellent choice for students and aspiring developers.
Pascal's key features include strong data typing, which promotes safer and more predictable code. The language also supports procedures and functions, which allow programs to be broken down into logical modules, making them easier to understand and maintain.
Pascal has been widely used in educational institutions to teach the basics of programming. However, over time, its popularity has declined, giving way to more modern languages such as C++, Java, and Python. However, Pascal still has its adherents and is used in several fields, including software and systems development.
Modern implementations of Pascal, such as Free Pascal and Delphi, continue to support and develop the language, providing developers with tools for creating powerful applications. These implementations add modern features and capabilities, making Pascal relevant for solving a variety of programming tasks.
Java is one of the most popular programming languages in the world. It was developed in 1995 by Sun Microsystems and has since become the basis for creating a variety of applications, ranging from mobile to server technologies. The main advantage of Java is its platform independence, which allows developers to write code once and run it on any device that supports the Java Virtual Machine (JVM).
Java has a simple and understandable syntax, making it accessible to novice programmers. Being an object-oriented language, Java supports the principles of encapsulation, inheritance, and polymorphism, which contribute to the creation of scalable and maintainable applications.
Java also has an extensive library of standard classes, which allows developers to effectively solve many problems without writing code from scratch. This speeds up the development process and improves the quality of the final product.
With Java, you can develop web applications, mobile applications for Android, and also create systems for large enterprises. There are numerous frameworks, such as Spring and Hibernate, that simplify the development and management of complex projects.
Another important aspect is the active community of Java developers, which promotes the exchange of knowledge and resources. This makes learning Java more accessible and effective.
Java continues to evolve, and new versions of the language regularly add new features, improving performance and security. This makes Java a relevant choice for software development in today's environment.
Programming education traditions vary across the world. Pascal has been a staple in educational systems for decades, leading to the creation of numerous textbooks and manuals. Experienced teachers who have worked with Pascal continue to pass on their knowledge to new generations of students. However, modern educational institutions recognize the need to update their curricula and are beginning to implement new programming languages, such as Python. This allows students to acquire relevant skills that align with labor market demands and current technology trends.
Pascal Syntax
Now let's take a closer look at the syntax of the Pascal programming language. For easy experimentation with the examples in this article, you can use online compilers such as GDB and JDoodle. These tools allow you to quickly and easily test your code, making the learning process more effective.
The code of any Pascal program must strictly adhere to the established structure. Ignoring this structure will result in the program not being able to execute. The basic template of a Pascal program includes the main components that ensure the correct operation of the code.
Let's analyze this text in detail.
- program MyFirstProgram is the program header, which specifies the name. This block is optional and can coincide with the file name.
- const is a block with the declaration of constant values (constants) that do not change during program execution.
- var is a block with the declaration of variables. At this stage, you do not need to pass values to them, it is enough to specify the type.
- procedure ProcedureName; is a procedure declaration block. It is important that the code of the procedure itself is between the begin and end keywords.
- function FunctionName: returnType; is a function declaration block. Here, everything is the same as with procedures, you just need to specify the type of the value that the function returns.
Please note!
Procedures and functions in the Pascal programming language have a lot in common, but the key difference is that a function must always return a value upon completion. Unlike modern programming languages, where the distinction between procedures and functions is often blurred, in Pascal this distinction is clearly defined. If you have not worked with Pascal before, this may cause some difficulty in understanding. Understanding these fundamental concepts is an important step for successfully learning Pascal and using it in programming.
- The main code of a program is the code that comes at the very end, after declaring everything that will be used in it. It should also be located strictly between the begin and end keywords. At the end of the program, put a period.
The given examples show that a semicolon (;) must be used to separate lines. This rule applies in all cases except for the else and until statements, which do not require a semicolon before them. Proper code formatting promotes readability and comprehension, which is especially important when working with programming logic. Following these simple rules will help avoid errors and improve the structure of your code.
Pascal is a strongly typed programming language, which means that the data type of each variable must be explicitly specified. Developers can use several basic data types, such as integers, real numbers, characters, and strings. This improves the reliability and readability of code and facilitates debugging. Strong typing helps avoid errors associated with the incorrect use of variables, making Pascal an ideal choice for learning to program and developing complex applications.
In addition to simple data types, the Pascal programming language uses structural types. These types allow you to combine multiple elements, creating more complex and versatile structures. Structural data types in Pascal include arrays, records, and sets. Using these types allows you to organize data more efficiently, which simplifies the development process and improves code readability. Structural types are an important tool for creating complex programs, allowing developers to group related data and manage it more conveniently.
- An array is a data structure that stores multiple elements of the same type. When declaring it, you must specify the name, size of the array, and the data type used. In the program code, you can access the array elements by index.
- A set is a structured data type that stores a collection of unique elements of the same type. Sets can be operated on, such as union, intersection, and checking whether an element belongs to a set.
Operators in Pascal are the key elements that control actions with variables. They perform various functions, allowing developers to effectively interact with data. One of the main operators is the assignment operator :=, which indicates the need to write the value on the right to the variable on the left. It is important to learn other operators present in the Pascal language to expand your programming skills and improve your efficiency in working with data. Let's take a closer look at the various operators available in Pascal and their uses in programming.
Developers often use arithmetic operators, which function similarly to mathematical operators. However, there are some peculiarities worth keeping in mind.
Comparison operators compare values by ordering them from left to right and return the result as true or false. These operations are an important tool for analyzing data and managing logic in programming. Comparisons allow developers to make decisions based on conditions, making code more dynamic and adaptive to different scenarios. Using comparison operators, you can effectively implement logic based on comparing numbers, strings, and other data types.
Logical operators perform operations on logical values, such as truth and falsity. These operators are the basis for logical inference and are used in various fields, including programming, mathematics, and philosophy. The main logical operators include «AND», «OR», and «NOT». The «AND» operator returns true only when both operands are true. The «OR» operator returns true if at least one of the operands is true. The «NOT» operator inverts a logical value, turning true into false and vice versa. Understanding logical operators is critical for developing algorithms, creating logical expressions, and solving problems related to data analysis.
- and — logical AND;
- or — logical OR;
- not — logical NOT.

Reworked text:
Also learn:
Basic Logical Bitwise Operations: What They Are and How They Work
Logical bitwise operations are fundamental operations performed on binary numbers in computers and digital systems. These operations are used to manipulate data at the bit level, which is the core operating principle of modern computing systems.
Basic logical bitwise operations include AND, OR, NOT, XOR, and their variations. The AND operation returns 1 only if both bits are 1. The OR operation returns 1 if at least one bit is 1. The NOT operation inverts the state of a bit, turning 0 into 1 and vice versa. The XOR operation returns 1 if the bits are different.
These operations are widely used in programming, cryptography, and data processing. Understanding logical bitwise operations allows you to optimize algorithms and improve software performance. Understanding their operation is also necessary for developing low-level systems and interacting with hardware.
Logical bitwise operations are the basis for creating more complex computational processes and algorithms, and studying them is an important part of the educational process in the fields of computer science and programming.
Sets also have their own operators that simplify working with this data structure. These operators allow developers to avoid wasting time implementing basic functions from scratch, providing convenience and efficiency when working with sets.
- + — union of sets;
- * — intersection of sets;
- — — difference of sets;
- in — test for membership of an element in a set.
Set union is the process by which two or more sets are combined to create a new set containing all unique elements. For example, if we have the set [1, 2, 3] and the set [3, 4, 5], their union will result in the set [1, 2, 3, 4, 5]. In this result, each element appears only once, which is a key aspect of the properties of sets. This approach allows for efficient data management and finding unique values in various applications, including databases and data analysis.
Conditional operators allow you to perform certain actions when specified conditions are met. The most common construct is if … then … else. In general, it is represented as follows:
The else keyword is used to define operations to be performed if a specified condition is false. This keyword is optional and can be omitted if the program does not need additional actions when the condition is false. Using else makes code more readable and understandable, providing clear program logic.
Let's create code that checks whether the value of the variable x is greater than 3. If this condition is met, the message «x > 3» will be displayed in the console. Otherwise, the user will see the message «x <= 3». To output text to the console, we will use the writeln() function.
When choosing one action from several predefined options, it is advisable to use the case ... of statement. This statement allows you to organize your code in a more structured and readable way, ensuring ease of handling various cases. In general, it has the following format:
The code provided uses the HTML structure, which helps organize content on a web page. It's important to pay attention to the correct markup of elements to ensure user experience and improve search engine indexing. Ensure all tags are used for their intended purpose and attributes are correctly specified. This will not only help create an aesthetically pleasing design but also improve SEO. It's also recommended to use semantic tags, such as <header>, <footer>, <article>, and <section>, to improve the document structure and make it more understandable for search engines. Proper content organization helps increase its visibility and improve its position in search results.
- Expression is a variable or expression whose result Pascal will check for compliance with the values.
- Values are possible values of the expression.
- Operator is an action to be performed if the expression is equal to the corresponding value.
- else handles the case if none of the values match.
Let's create a program that will determine the name of the day of the week based on its ordinal number. The program will accept an integer from 1 to 7, corresponding to the days of the week: 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday, 7 - Sunday. If the entered number is not within the specified range, the program will display an error message. This approach will allow users to easily find the desired day of the week by simply entering its number.
The day variable is set to 4, which will result in the day of the week being displayed in the console as Thursday.
Loops allow you to repeatedly execute a specific block of code as long as a specified condition is met. There are three main types of loops in the Pascal programming language:
The `for` loop is used to execute code a fixed number of times, which is especially convenient when the number of iterations is known in advance. The `while` loop executes a block of code as long as a condition is true, which allows for flexible control of the number of iterations depending on dynamic conditions. The `repeat` loop also executes code until a condition becomes true, but it also guarantees that the block of code will be executed at least once.
Knowledge and ability to use these types of loops significantly simplify the solution of programming problems and make the code more efficient.
- for … to … do is used when the number of iterations is known in advance, and the value of the control variable is increased or decreased at each step.
- while … do is executed as long as the loop condition is true. The number of iterations is not known in advance.
- repeat … until is also executed as long as the condition is true.
In Pascal, two operators are used to comment code: { … } and (* … *). They allow you to highlight fragments of code and text that will be ignored by the compiler. This is useful for adding explanations to complex functions or explaining the operation of algorithms to other programmers who will continue your work. Both operators perform the same function, but it is important to adhere to a consistent syntax: you cannot begin a comment with one operator and end it with another, for example, you cannot use { … *) for a single comment. Proper use of comments improves the readability of code and makes it easier to maintain.
Comments can be either single-line or multi-line. Single-line comments are used for brief notes and can occupy a single line. Multi-line comments, on the other hand, allow you to add more extensive explanations or descriptions, spanning multiple lines. This approach to commenting code helps improve its readability and maintainability, and also makes it easier to understand the structures and logic embedded in the code. Proper use of comments promotes more efficient teamwork and simplifies the process of making changes to the project.
Hello, Pascal: Writing a Game of Rock, Paper, Scissors
We have enough knowledge to create a full-fledged game that runs in the terminal. In this project, we will develop the code for the classic game of Rock, Paper, Scissors, popular among children. During the course of our work, we will also become familiar with the crt module, which allows us to interact with the console, and explore the random number generator for generating random enemy moves.
Developing in Pascal requires a compiler that is compatible with your operating system. In this guide, we will cover in detail the installation process of PascalABC.NET for the Windows operating system, which will provide you with all the necessary tools for effective Pascal programming.
- Go to the official website of the PascalABC.NET project and open the Download section.

- Select the required assembly (with or without the problem book) and click the Download button.

- In Downloads, find the PascalABCNETSetup.exe file, run it, and follow the installation steps.
- Find the PascalABC.NET application in the Start menu and run it.
- In this development environment, you can write Pascal code and run it.

First, let's define the program name, import the crt module, and declare the necessary variables. In Pascal, third-party modules are included using the uses keyword. In our game code, we will use only three variables.
- playerChoice, computerChoice - to store the user and computer moves.
- playAgain - to interact with the menu.
Let's create the ShowChoices procedure, which will display the move selection menu in the console. Using several calls to the writeln() function, we will provide the user with a list of available options for making a move. This will help the player quickly navigate the possibilities and make an informed choice.
We need a procedure that will determine the winner based on the user and computer choices. Let's call this procedure DetermineWinner and specify the necessary parameters. To correctly determine the winner, remember that scissors cut paper, paper wraps rock, and rock breaks scissors. This logic will allow you to accurately determine who has won the game.
Everything is ready to begin developing the main game loop. This loop will continue until the user chooses to end the game by entering n or N into the console. The core logic of the game is as follows: the gameplay will progress through a sequence of actions that will repeat, providing interactivity and player engagement. Each stage of the loop will involve processing user input, updating the game state, and visualizing the changes, creating a dynamic gaming environment.
- Initialize the random number generator.
- Clear the screen using the clrscr function from the crt module we exported earlier, and display the menu using the ShowChoices procedure.
- Receive the user's move and ensure that they only enter values that are in the menu (numbers from 1 to 3). If you entered something different, we ask you to make your choice again.
- We generate a random computer move using the random() function and select a winner using the DetermineWinner procedure.
- We ask the user if they want to play again.
The main game loop code is a key part of game development. It is responsible for updating the game state and managing interactions between objects in the game world. The main loop includes sequential steps, such as processing user input, updating game logic, and rendering graphics. An effective implementation of the main loop helps ensure smooth gameplay and high performance. Optimizing this code is also important for improving the user experience and reducing lag when interacting with the game. Proper resource management and minimizing the load on the CPU and graphics card are critical aspects in developing a successful game.
The game operates in console mode. Users can interact with it through text commands, which creates a unique gaming experience. The console interface allows for quick access to information and gameplay management. Players can easily adjust game settings and monitor their progress in real time. Effective use of the console promotes immersion in the gameplay and the development of strategic thinking.

The full game code is provided below:
What's Next
In this article, we covered the main aspects of the Pascal language. If you want to deepen your knowledge and master the language in more detail, we suggest you familiarize yourself with useful resources and materials on Pascal.
- PascalABC.NET courses on Stepik - a collection of free courses for both schoolchildren and adults. There are separate courses for preparing for programming on the Unified State Exam.
- Books on PascalABC.NET — books by Alexander Osipov and Valery Rubantsev are suitable for schoolchildren and first-year students, and Mikhail Abramyan's two-volume work is the official guide from the Southern Federal University on working with data structures.
- LearnPascal — a site with Pascal lessons and problem solutions.
- Rosetta Code — a collection of problem solutions, including in Pascal.
- Codewars — a service for practicing solving algorithmic problems. You can select Pascal from the list of programming languages.

