Computer Science
Structured English

Structured English is a way of describing an algorithm using a small subset of the English language and a few simple conventions.

There are no clear standards for Structured English.

Sequence

An instruction in Structured English should being with a verb.

For example,

INPUT hours worked
MULTIPLY hours worked by rate of pay
OUTPUT pay

When you have reached the section of the programming guides on procedures and functions, you will learn that it is common to group a series of statements like this into one logical block of code with a unique name in the program.

Imagine we had labelled the above algorithm with the unique name CalculatePay. We might then refer to this group of statements as follows,

DO CalculatePay

Assignment

In Structured English we use the term SET when we assign a value to a variable. For example,

SET hoursworked to 40

Selection

We have 3 main options to show selection in our algorithms,

  1. IF ... Then
  2. IF ... Then ... Else ...
  3. SELECT ...

For example,

IF error found
   THEN OUTPUT "Error"

And,

IF error found
   THEN OUTPUT "Error"
   ELSE OUTPUT "All Fine"

And finally,

SELECT VALUE errorNumber
   1: OUTPUT "Error Number 1"
   3: OUTPUT "Error Number 3"
   5: OUTPUT "That's a bad miss"
END SELECT

The indentation is good practice, makes the code easier to read and has to be seen as a compulsory part of the process.

Iteration

We can represent repetition in our algorithms using the following constructs in Structured English

FOR EACH employee
   DO CalculatePay

And

REPEAT UNTIL no more employee records
   READ next employee record
   READ hours worked
   READ pay rate
   MULTIPLY pay rate by hours worked

And finally,

DO WHILE more employee records to process
   READ next employee record
   READ hours worked
   READ pay rate
   MULTIPLY pay rate by hours worked