Questions tagged [pascal]

Pascal is an imperative language from the Wirthian family created in 1969. It was widely used in engineering and teaching in the 1970s and 1980s. It lives on in compilers as Free Pascal and Delphi.

Pascal is an influential imperative and procedural programming language, designed in 1969 and published in 1970 by Niklaus Wirth as a small and efficient language. It was largely (but not exclusively) intended to teach students structured programming and data structuring.

Pascal is a descendant of , but it was implemented on a wide range of architectures, from PDP-11s, IBM PCs, to CDC Cyber and IBM System 370 mainframes. Pascal probably reached critical mass around the time Borland released Turbo Pascal in 1983.

Wirth later developed Modula-2 and Oberon and those languages share much of Pascal's design. Other derivatives include OOP-based Object Pascal (used in Delphi and Lazarus/Free Pascal).

Pascal is a purely procedural language and includes control statements with reserved words such as if, then, else, while, for, and so on. However, Pascal also has many data structuring facilities and other abstractions not included in ALGOL 60 like type definitions, records, pointers, enumerations, and sets.

External Resources

Free Pascal/Delphi Programming Books

2598 questions
7
votes
1 answer

What this phrase {$R *.dfm} in the code editor?

What this phrase {$R *.dfm} in the code editor? I tried This : //{$R *.dfm}
Djemoui
  • 77
  • 7
7
votes
7 answers

Why do Pascal control structures appear to be inconsistent?

Most Pascal control structures make sense to me, like: for ... do {statement}; if (condition) then {statement}; while (condition) do {statement}; where the {statement} is either a single statement, or a begin ... end block. I have a problem…
70Mike
  • 304
  • 2
  • 12
7
votes
5 answers

How can I use WriteLn with an enum type?

I'm trying to make a custom data type for days of the week but I can't get it to write it. The compiler error says this: [Error] hours.dpr(28): Illegal type in Write/Writeln statement program hours; {$APPTYPE CONSOLE} uses SysUtils; type …
Tom
  • 79
  • 1
  • 2
7
votes
1 answer

Application.MainFormOnTaskbar := False; not hiding application from taskbar

Why setting Application.MainFormOnTaskbar to False is not preventing the application from showing on taskbar? Please help. Thanks.
emurad
  • 3,448
  • 10
  • 40
  • 47
7
votes
2 answers

Delete first N characters from TextFile without creating a new file (Delphi)

I just wanna to delete from specified text file first N characters, but i'm stuck. Help me please! procedure HeadCrop(const AFileName: string; const AHowMuch: Integer); var F: TextFile; begin AssignFile(F, AFileName); // what me to do next? …
SomeOne
  • 365
  • 1
  • 5
  • 10
7
votes
11 answers

What language can I use instead of Turbo Pascal?

I was using Turbo Pascal for about 20 years, but now I have changed my computer, and I have Windows 7 now. TP does not work under it. What similar language can I use instead of TP, that will require from me to spend minimum possible time studying…
Nick
  • 79
  • 1
  • 2
7
votes
3 answers

Can Identifiers be duplicated across cases of a variant record in FreePascal?

Here's my problem: I want to create a record type where among the cases of a variant record, some, but not all, will have a certain field. According to the wiki, this is perfectly legal. And yet, when I tried to compile the following code: program…
junius
  • 570
  • 3
  • 14
7
votes
1 answer

Is there a way to use ONE procedure for multiple buttons in Pascal?

I am looking for a way to use one procedure for multiple buttons. It's for a quiz like you have to press Button 1 for question 1, but copy and pasting the whole code for 36 buttons and changing the variables for 36 buttons isn't really fun for…
7
votes
1 answer

Quicksort drama

I just could smash my head against the wall. I do not understand, why my following quicksort algorithm is not working. It is written in Pascal: program quicksort; Type iArray = array [0..8] of integer; var intArray, newArray : iArray; Function…
gutenmorgenuhu
  • 2,312
  • 1
  • 19
  • 33
7
votes
2 answers

Usage of # in Pascal

Q1: What does this mean: WriteLn (#$0b)? $0b should hexadecimal like 0x0b, but what about the # sign? Q2: x:=readkey; if ( x = #5) do... Does #5 mean five? Then what is the# sign for? Many thanks.
7
votes
7 answers

Why does Pascal forbid modification of the counter inside the for block?

Is it because Pascal was designed to be so, or are there any tradeoffs? Or what are the pros and cons to forbid or not forbid modification of the counter inside a for-block? IMHO, there is little use to modify the counter inside a…
Jichao
  • 40,341
  • 47
  • 125
  • 198
7
votes
2 answers

Delphi SizeOf(NativeInt) vs C sizeof(int) on x86-64. Why the Size difference?

Preface So after a long time of C only work I came back to Delphi and found out that there are some new things in Delphi. One being NativeInt. To my surprise I discovered that Delphi and C handle their "native integer"1 types different for x86-64.…
RotatingPieces
  • 413
  • 2
  • 8
7
votes
1 answer

Inno Setup Directory Exists

I am trying to check in inno setup if a directory exists and i would like to do so manually respectively programmatically. The Setup I am creating in Inno setup is an update. Here comes the tricky part, the initial setup uses a C# application to…
Bongo
  • 2,933
  • 5
  • 36
  • 67
7
votes
1 answer

Releasing partial source code to customer

I have written a program for a company. They want the source code. The program uses code that I've written over time for several projects for a number of clients. I want to release only the code that is used by this program. So if a shared file…
cja
  • 9,512
  • 21
  • 75
  • 129
7
votes
2 answers

Write apostrophe sign in writeln function - Pascal

How can I print the apostrophe sign in Pascal using the writeln function? Example: writeln('My brother's book'); wouldn't work because s book is out of "writing" function, so the compiler returns an error: Fatal: Syntax error, ")" expected but…
Vukašin Manojlović
  • 2,645
  • 2
  • 21
  • 26