Pseudocode

What is Pseudocode?

Pseudocode are the simple clear steps you would make when you plan your code. It is often not written in any coding language syntax and essentially boil down to a bullet list of notes describing what each function/section is needed and what their purpose is, as well as outlining the logic of your code in order.

Taking the time to write out your code as pseudocode first will let you:

  • Get your programming logic clearly laid out so you can check that it makes sense
  • Make less errors by allowing you to identify any problem areas early on
  • Debug quicker and easier because your algorithms have been organised
  • Let you communicate quicker and clearer if you ware working in a team
  • Easily translate into most other programming languages

Pseudocode Structure

As well as the basic flow of the code, you should specify some programming concepts (where relevant) such as:

  • Input: Receive information from the user
  • Process: Perform calculations or make decisions
  • Decision Making: Use conditions such as IF, ELSE, or CASE
  • Loops: Repeat actions using constructs like FOR or WHILE
  • Output: Display the result to the user

A simple example may be for a script that would check if an entered number is even or odd. The pseudocode may look like:


# START

# INPUT number

# IF number is divisible by 2 THEN
    # OUTPUT "Even"
#ELSE
    # OUTPUT "Odd"
# END IF

# END

Just remember to write each step in a clear, logical order, and keep the language simple and easy to read. Overall you will find that this will break a program or parts of a program into easier manageable steps.