Wednesday, March 21, 2012

2. Pascal statements

Used to clean / clear the screen. 

write / writeln  
Used to display text or value of a variable on the screen.Difference between the write writeln is at the cursor position after the statement is executed. On write, the cursor will be behind the text, while the writeln, the cursor will be on the next line. 
write ('example'); 
writeln ('example'); 
writeln (a), (showing the contents of a variable) 
write ('Hello', a); 

read / readln 
Used to read and enter a value that is inputted through the keyboard into a variable. 
readln (a), (insert the data inputted into the variable a) 
readln; (waiting for the user presses the enter button before proceeding to the next statement)