First Program
This lesson outlines the basics of creating your first program and is intended for those of you who are new to programming and pascal all together.
The majority of programs that you make in pascal will always follow the below format, it is first typed into the compiler when making your program:
program ProgramName;
{$APPTYPE CONSOLE}
uses SysUtils;
begin
end.
You would write a meaningful program named where I wrote “ProgramName” as to tell the person who is reading your source code, what the program does. Then perhaps a comment afterwards to describe what purpose your program serves.
Between “begin” and “end.” is where you write the main part of your program. Below is an example of a simple program which would display “Hello World” on the screen.
program HelloWorld;
{a program which displays "hello world" on the screen }
{$APPTYPE CONSOLE}
uses SysUtils;
begin
{the code that displays Hello World! on the screen}
writeln('Hello World');
end.
Try it out in your compiler to see how it works.