Professional Documents
Culture Documents
Common Pascal Procedures
Common Pascal Procedures
2. Program control and display Procedures & Functions Function Description ClrScr* Clears the screen and returns the cursor to the upper left corner. procedure ClrScr; Dec Decrements a variable. procedure Dec(var X[ ; N: Longint]); DoneWinCrt** Closes the WinCRT window procedure DoneWinCrt; Exit Exits immediately from the current block. procedure Exit; NB If the current block is the main program, Exit causes the program to terminate. Halt Stops program execution and returns to the operating system. procedure Halt [ ( Exitcode: Word ) ]; Exitcode is an optional expression that specifies the exit code of the program. Inc Increments a variable. procedure Inc(var X [ ; N: Longint ] );
Example
readln; clrScr;
end.
var i: integer;
end.
uses WinCrt;
end.
var
if i>10 then exit; writeln(i); end; {loop will only get to 10} end.
begin if 1 = 1 then
if 3 = 3 then begin halt; end; end; end; writeln('This is never Printed'); end.
var i: integer;
end.
begin repeat
end.
var c: char;
end.
* These functions are in the winCRT unit of Turbo Pascal for Windows. They are also available in the CRT unit of Free Pascal - to use them include the line 'uses CRT;' in the declaration of your program. ** This procedure is in the winCRT unit of Turbo Pascal, and is not available in FreePascal.