Pseudocode Cambridge 2
Data Types
INTEGER: A whole number.
REAL: A number that can contain a fractional part.
CHAR: A single character.
STRING: A sequence of zero or more characters.
BOOLEAN: Represents logical values TRUE and FALSE.
DATE: A valid calendar date.
Pseudocode Cambridge Declarations
Variables
Declaration:
DECLARE <variable name>: <data type>
Constants
Declaration:
CONSTANT <identifier> = <value>
Arrays
1D Array:
DECLARE <array name>: ARRAY[<lower>:<upper>] OF <data type>2D Array:
DECLARE <array name>: ARRAY[<lower1>:<upper1>, <lower2>:<upper2>] OF <data type>
Assignment
Variable Assignment:
<variable name> <- <value>
1D Array Assignment
FOR Index <- lower TO upperarray_name[Index] <- <value>NEXT Index
2D Array Assignment
FOR RowIndex <- lower1 TO upper1FOR ColumnIndex <- lower2 TO upper2array_name[Index] <- <value>
NEXT ColumnIndex
NEXT RowIndex
Common Pseudocode Statements
INPUT:
INPUT <variable name>OUTPUT:
OUTPUT <text(s)>,<value(s)>
Operators
Addition:
+Subtraction:
-Multiplication:
*Division:
/(REAL output)Integer Division:
DIVModulus:
MOD(Remainder after division)String Join:
&(Join two strings)
Pseudocode Cambridge Basic String Functions with Examples
RIGHT(ThisString : STRING, x : INTEGER) RETURNS STRING
Example: `RIGHT(