teach-ict.com logo

THE education site for computer science and ICT

2. Planning a structure

The ability to break down a task into smaller tasks is an essential skill in computer programming. As a programmer, you need to consider how you are going to structure the code.

A program that has no structure at all will be one of two things:

  1. Very simple and it is obvious how it works.
  2. Badly coded so it becomes difficult to understand how it works or to modify it later.

This is an example of the first kind:

               OUTPUT 'The colours of the rainbow are'
               OUTPUT 'red'
               OUTPUT 'orange'
               OUTPUT 'yellow'
               OUTPUT 'green'
               OUTPUT 'blue'
               OUTPUT 'indigo'
               OUTPUT 'violet'           

We have a Python demo of this here

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Structured programming