Pascal
Pascal is a programming language. It was created in 1970 by Niklaus Wirth, to help people learn how to make computer programs.
This article does not have any sources. (August 2025) |
Pascal is a programming language. It was created in 1970 by Niklaus Wirth, to help people learn how to make computer programs.
Development
Now, there are many different dialects of the language, some of which support object-oriented programming. In 1990 the “Pascal” and “Extended Pascal” standards were registered with the International Organization for Standardization.
Description
Every variable has to be declared before it is used. Pascal is a strongly typed programming language: Every variable has a data type. You are only allowed to assign values to the variable that are valid for the data type. This ensures that the programmer does not make unintentional mistakes.
Pascal is a imperative language.
The language distinguishes between procedures and functions.
A function returns a value, a procedure does not.
As such, a function call appears in an expression, whereas a procedure invocation is a statement.
Code samples
This code prints Hello world! at console window:
program helloWorld(output);
begin
writeLn('Hello world!');
{ which is short for: writeLn(output, 'Hello world!); }
end.
This code calculate factorial of a positive integer, using recursion.
program factorialDemo(input, output);
function factorial(n: integer): integer;
begin
if n < 2 then
begin
{ the result of a function is stored in a variable }
{ that has the same name as the function: }
factorial := 1;
end
else
begin
factorial := n * factorial(n - 1);
end
end;
var
n: integer;
begin
write('Enter number: ');
readLn(n);
writeLn(factorial(n));
end.
Pascal variants
- GNU Pascal
- Object Pascal
- Free Pascal
- Delphi – Modern IDE for creating GUI programs for Microsoft Windows. There is an open source clone of it for Windows, Mac OS X and FreeBSD, named Lazarus.
- Turbo Pascal
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.