91热爆

Reference Language

Reference Language is used in National 5 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 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 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
^

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

String Handling

OperationSymbol
Join strings or substrings/Concatenation
&
Determine string length/number of characters
length
OperationJoin strings or substrings/Concatenation
Symbol
&
OperationDetermine string length/number of characters
Symbol
length