Reference languageReference language

It is important to read and understand a formal language. Declaring variables and data types, using selection statements, iteration and using operators are comprehensions required before coding.

Part ofComputing ScienceSoftware design and development

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)

OperationSymbol
Add
+
Subtract
-
Multiply
*
Divide
/
Minus
-unary
Exponent (to the power of)
^
OperationAdd
Symbol
+
OperationSubtract
Symbol
-
OperationMultiply
Symbol
*
OperationDivide
Symbol
/
OperationMinus
Symbol
-unary
OperationExponent (to the power of)
Symbol
^

Operations (Interger only)

OperationSymbol
Modulo/Find the remainder of
mod
OperationModulo/Find the remainder of
Symbol
mod

Comparison Operators

OperationSymbol
Equality/Equals
=
Inequality/Does not equal
Less than
<
Less than or equal to
Greater than
>
Greater than or equal to
OperationEquality/Equals
Symbol
=
OperationInequality/Does not equal
Symbol
OperationLess than
Symbol
<
OperationLess than or equal to
Symbol
OperationGreater than
Symbol
>
OperationGreater than or equal to
Symbol

Logical Operators

OperationSymbol
Both Required (conjunction)
AND
One or the other required (disjunction)
OR
Not (negation)
NOT
OperationBoth Required (conjunction)
Symbol
AND
OperationOne or the other required (disjunction)
Symbol
OR
OperationNot (negation)
Symbol
NOT