Jump to content

[PASCAL] Hello World


PresidenT AnaS
 Share

Recommended Posts

Today we have new type of Pascal which is called "Hello world".

Before we study basic building blocks of the Pascal programming language, let us look a bare minimum Pascal program structure so that we can take it as a reference in upcoming chapters.

Pascal Program Structure:

A Pascal program basically consists of the following parts −

1| Program name

2| Uses command

3| Type declarations

4| Constant declarations

5| Variables declarations

6| Functions declarations

7| Procedures declarations

8| Main program block
9| Statements and Expressions within each block
10| Comments
Every pascal program generally has a heading statement, a declaration and an execution part strictly in that order. Following format shows the basic syntax for a Pascal program −
program {name of the program}
uses {comma delimited names of libraries you use}
const {global constant declaration block}
var {global variable declaration block}

function {function declarations, if any}
{ local variables }
begin
...
end;

procedure { procedure declarations, if any}
{ local variables }
begin
...
end;

begin { main program block starts}
...
end. { the end of main program block }
Pascal Hello World Example
Following is a simple pascal code that would print the words "Hello, World!":
program HelloWorld;

uses crt;

(* Here the main program block starts *)
begin
writeln('Hello, World!');
readkey;
end.

 

This will produce following result −
Hello, World!
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.