About Pascal
The Pascal programming language was created by Niklaus Wirth in 1970. It was named after Blaise Pascal, a famous French Mathematician. It was made as a language to teach programming and to be reliable and efficient. Pascal has since become more than just an academic language and is now used commercially.
What you will need
Before you start learning Pascal, you will need a Pascal compiler. This tutorial uses the Turbo pascal 1.5 You can download here Turbo PascalYour first program
The first thing to do is to either open your IDE if your compiler comes with one or open a text editor.We always start a program by typing its name. Type program and the name of the program next to it. We will call our first program "Hello" because it is going to print the words "Hello world" on the screen.
program Hello;
Next we will type begin and end. We are going to type the main body of the program between these 2 keywords. Remember to put the full stop after the end.
program Hello;
begin
end.
The Write command prints words on the screen.
program Hello;
uses wincrt;
begin
Write('Hello world');
end.
example |
You will see that the "Hello world" is between single quotes. This is because it is what is called a string. All strings must be like this. The semi-colon at the end of the line is a statement separator. You must always remember to put it at the end of the line.
The Readln command will now be used to wait for the user to press enter before ending the program.
You must now save your program as hello.pas.uses wincrt;program Hello;
begin
Write('Hello world');
Readln;
end.
0 komentar on Tutorial Pascal Programming 1 :
Post a Comment and Don't Spam!