Pseudocode implements the basic control structures of assignment, sequence, selection, condition, iteration and modularisation through the use of keywords associated with the constructs, and textual indentation.

It is used to show how a computing algorithm should and could work, it is often an intermediate step in programming between the planning stage and writing executable code. Pseudocode can also be useful for:

Pseudocode does not have a standard format and varies from programmer to programmer.
However, a number of conventions are generally used.

Conventions for writing pseudocode

KEYWORDS are written in bold capitals and are often words taken directly from programming languages.

For example, IF, THEN and ELSE are all words that can be validly used in most languages

OUTPUT and COMPUTE are from the language COBOL and WRITE is from the language Pascal.

Keywords do not have to be valid programming language words as long as they clearly convey the intent of the line of pseudocode.

Statements that form part of a REPETITION LOOP are indented by the same amount to indicate that they form a logical grouping.

In a similar way, IF, THEN and ELSE statements are indented to clearly distinguish the alternative processing paths.

The end of REPETITION LOOPS and IF, THEN and ELSE statements are explicitly indicated by the use
of ENDWHILE and ENDIF at the appropriate points.

Pseudocode should clearly indicate what is happening at each step, including formulas of calculations.

For example:

CALCULATE net is not as clear as CALCULATE net = gross − tax.

Programmers prefer to use a more abbreviated version in which memory cells used to store the input are given program-like names.
For example:

INPUT num1
INPUT num2
is preferable to
INPUT first number
INPUT second number

More resources