Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/de

한국어 · Deutsch · English · Français · Български · Русский · 中文(中国) · 日本語

1G - Interpunktion und Einrückung

(Autor: Tao Yue, Übersetzung ins Deutsche)

Da Pascal Zeilenende und Leerzeichen ignoriert, ist eine Interpunktion erforderlich, um dem Compiler mitzuteilen, wann eine Anweisung endet.

Du musst ein Semikolon folgen lassen:

Die letzte Anweisung in einem BEGIN-END-Block, die unmittelbar vor dem END steht, benötigt kein Semikolon. Es ist jedoch harmlos, eines hinzuzufügen, und es erspart Dir das Hinzufügen eines Semikolons, wenn Du die Anweisung plötzlich nach oben verschieben musst.

Einrücken ist nicht erforderlich. Es ist jedoch von großem Nutzen für den Programmierer, da es hilft das Programm klarer zu machen. Wenn Du wolltest, könntest Du so ein Programm wie dieses haben:

pascal
program Stupid; const a=5; b=385.3; var alpha,beta:real; begin 
alpha := a + b; beta:= b / a end.

Aber es ist viel besser, wenn es so aussieht:

pascal
program NotAsStupid;

const
  a = 5;
  b = 385.3;

var
  alpha,
  beta : real;

begin (* main *)
  alpha := a + b;
  beta := b / a;
end. (* main *)

Im Allgemeinen wird jeder Block eingerückt und eine Zeile zwischen Blöcken übersprungen (z.B. zwischen den const- und var-Blöcken). Moderne Programmierumgebungen (IDE, oder Integrated Development Environment) verstehen die Pascal-Syntax und werden oft für Dich einrücken, während Du tippst. Du kannst die Einrückung nach Deinen Wünschen anpassen (Tabulator als drei oder vier Leerzeichen anzeigen?).

Die richtige Einrückung macht es viel einfacher zu bestimmen, wie Code funktioniert, wird aber durch vernünftige Kommentare enorm unterstützt.


From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/de", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 3 people, 2018–2022

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
GenosseCreated page
TrevFixed syntax highlighting (minor)
Kai BurghardtKai Burghardt moved page Punctuation and Indentation/de to Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/de: tidy up main name space: create subpage hierarchy for basic Pascal tutorial [... (minor)
Kai Burghardtbypass redirects [cf. discussion]
Kai Burghardtbypass language bar/categorization template redirect [cf. discussion] (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.