Reference language
A standardised reference language is used in National 4 Computing Science. This language differs from pseudocode in that there is a clear structure that must always be adhered to. It is essential to be able to read and understand this reference language.
Reference language is formal which means, while appearing very similar, it is not pseudocode. It provides everyone studying Computing Science with a standard that must be understood by all.
Basic elements
Identifiers
Identifiers should not contain spaces and should always start with a letter. In this example, high score could be identified as:
- highscore
- high_score
- highScore
Arrays can be identified by the inclusion of square brackets. An array of high scores could be identified as:
- highscore[ ]
Array indexing will start from 0 unless otherwise stated.
The following tables contain basic elements of the reference language that can be grouped together easily.
Operations (Interger and Real data types)
| Operation | Symbol |
| Add | |
| Subtract | |
| Multiply | |
| Divide | |
| Minus | |
| Exponent (to the power of) | |
| Operation | Add |
|---|---|
| Symbol | |
| Operation | Subtract |
|---|---|
| Symbol | |
| Operation | Multiply |
|---|---|
| Symbol | |
| Operation | Divide |
|---|---|
| Symbol | |
| Operation | Minus |
|---|---|
| Symbol | |
| Operation | Exponent (to the power of) |
|---|---|
| Symbol | |
Operations (Interger only)
| Operation | Symbol |
| Modulo/Find the remainder of | |
| Operation | Modulo/Find the remainder of |
|---|---|
| Symbol | |
Comparison Operators
| Operation | Symbol |
| Equality/Equals | |
| Inequality/Does not equal | |
| Less than | |
| Less than or equal to | |
| Greater than | |
| Greater than or equal to | |
| Operation | Equality/Equals |
|---|---|
| Symbol | |
| Operation | Inequality/Does not equal |
|---|---|
| Symbol | |
| Operation | Less than |
|---|---|
| Symbol | |
| Operation | Less than or equal to |
|---|---|
| Symbol | |
| Operation | Greater than |
|---|---|
| Symbol | |
| Operation | Greater than or equal to |
|---|---|
| Symbol | |
Logical Operators
| Operation | Symbol |
| Both Required (conjunction) | |
| One or the other required (disjunction) | |
| Not (negation) | |
| Operation | Both Required (conjunction) |
|---|---|
| Symbol | |
| Operation | One or the other required (disjunction) |
|---|---|
| Symbol | |
| Operation | Not (negation) |
|---|---|
| Symbol | |