±«Óătv

Producing algorithms with pseudocode

Most are developed using . These languages have specific that must be used so that the program will run properly.

is not an actual programming language. Instead, it is a simple way of describing a set of instructions in a manner that resembles a programming language. It has its own syntax, some of which is very similar to many actual programming languages. Any designed using pseudocode will not run unless they are converted into an actual programming language.

This simple pseudocode algorithm asks a user to input what their favourite subject is:

while answer != 'computer science'
     answer = input ('What is your favourite subject? ')
     if answer == 'computer science' then
          print('Good choice!')
     else
          print('Really? ')
     endif
endwhile

Advantages and disadvantages of pseudocode

Designing an algorithm in pseudocode has benefits:

  • because pseudocode is similar to a programming language, it can be quickly and easily converted into an actual programming language
  • it is fairly easy to understand, even for non-programmers
  • it does not matter if there are errors in the syntax - it is usually still obvious what is intended
  • changes to the design can be incorporated quite easily

Pseudocode also has its disadvantages:

  • It can be hard to see how a program flows, for example, where does following one path as opposed to another take the program?
  • It can be time consuming to produce.

Pseudocode covers many areas of programming and there are different variants. The specific pseudocode syntax for your course can be found at the end of the .