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 upper

    • array_name[Index] <- <value>

    • NEXT Index

2D Array Assignment

  • FOR RowIndex <- lower1 TO upper1

    • FOR ColumnIndex <- lower2 TO upper2

      • array_name[Index] <- <value>

    • NEXT ColumnIndex

  • NEXT RowIndex

Common Pseudocode Statements

  • INPUT: INPUT <variable name>

  • OUTPUT: OUTPUT <text(s)>,<value(s)>


Operators

  1. Addition: +

  2. Subtraction: -

  3. Multiplication: *

  4. Division: / (REAL output)

  5. Integer Division: DIV

  6. Modulus: MOD (Remainder after division)

  7. String Join: & (Join two strings)

Pseudocode Cambridge Basic String Functions with Examples

  1. RIGHT(ThisString : STRING, x : INTEGER) RETURNS STRING

    • Example: `RIGHT(