A SIMPLE Pascal Program
Write a program to print the words 'Hello. How are you?' on the console screen.


	program MYFIRST (output);
	begin
		  writeln('Hello. How are you?')
	end.

The keyword writeln writes text to the console screen. The text to be displayed is written inside single quotes. After printing the text inside the single quotes, the cursor is positioned to the beginning of the next line.

To print a single quote as part of the text, then use two quotes, eg,


	program TWOQUOTES (output);
	begin
		  writeln('Hello there. I''m fine.')
	end.


	program output is;
	Hello there. I'm fine.
	_

Note the underscore character represents the position of the cursor

write versus writeln
The write statement leaves the cursor at the end of the current ouput, rather than going to a new line. By replacing the above program with a write statement, the result is,


	program TWOQUOTES (output);
	begin
		  write('Hello there. I''m fine.')
	end.


	program output is;
	Hello there. I'm fine._

Note the underscore character represents the position of the cursor

Write a program to print the the following words on the console screen.
         Hello. How are you?
         I'm just fine.

Click here for answer

Copyright B Brown/P Henry/CIT, 1988-1997. All rights reserved.

1