Catalog / Pascal Programming Cheatsheet
Pascal Programming Cheatsheet
A concise reference for Pascal programming language syntax, data types, control structures, and common functions, designed to aid both beginners and experienced programmers.
Fundamentals
Program Structure
A Pascal program generally follows this structure:
|
Data Types
Integer Types |
|
Real Types |
|
Character Type |
|
Boolean Type |
|
String Type |
|
Variable Declaration
Variables must be declared before use.
Example:
|
Control Structures
Conditional Statements
If-Then-Else
|
Case Statement
|
Looping Structures
For Loop
|
While Loop
|
Repeat-Until Loop
|
Procedures and Functions
Procedure Definition
|
Function Definition
|
Parameters
Value Parameters |
The value of the actual parameter is copied to the formal parameter. |
Variable (Var) Parameters |
The formal parameter becomes a reference to the actual parameter. Changes to the formal parameter affect the actual parameter. |
Input/Output and Standard Functions
Input/Output
Reading Input
Writing Output
|
Standard Functions
|
Returns the absolute value of x. |
|
Returns the square of x. |
|
Returns the square root of x. |
|
Returns the sine and cosine of x (in radians). |
|
Returns the arctangent of x. |
|
Returns e raised to the power of x. |
|
Returns the natural logarithm of x. |
|
Rounds x to the nearest integer. |
|
Truncates x to the integer part. |