Selection In Programming - KS3 Computer Science Revision - BBC

In this guide

  1. Revise
  2. Test
  1. Selection
  2. IF statements
  3. IF...ELSE
  4. if…else in Python
  5. Using ELSE IF to provide more choices

Selection

An algorithm is a plan, a set of step-by-step instructions designed to solve a problem. When designing algorithms there are three basic building blocks (constructs) that can be used:

  • sequencing
  • selection
  • iteration

Algorithms are used to help design programs that perform particular tasks.

What is selection?

An explanation of selection, as used in algorithms and programming

Open Transcript

Selection is a decision or question.

At some point, a program may need to ask a question because it has reached a step where one or more options are available. Depending on the answer given, the program will follow a certain step and ignore the others.

Selection is making a decision on which logical path to follow. In a theme park, the queuing system for a roller coaster might read 'IF front row, queue here, else, all other rows queue here'.

Why is selection important?

Key factSelection allows there to be more than one path through a program.

Many solutions feature several choices or decisions. These decisions lead to different paths through the program. These paths represent the result of making a choice. Without selection it would not be possible to include different paths in programs, and the solutions we create would not be realistic.

Selection in programming

Once an algorithm has been designed and perfected, it must be translated – or programmed – into code that a computer can read.

We create programs to implement algorithms. Algorithms consist of steps, where programs consist of statements.

Selection is implemented in programming using IF statements.

Next pageIF statements

More guides on this topic

  • Introduction to programming
  • Programming basics
  • Iteration in programming
  • Boolean logic
  • Arrays and lists
  • Procedures and functions
  • Writing error-free code

Related links

  • Jobs that use Computer Science
  • BBC Click
  • BBC Technology news
  • Tech Tent
  • Headsqueeze
  • Khan Academy
  • Raspberry Pi
  • Code Club Subscription
  • Educational App Store Subscription

Tag » What Is Selection In Computer Science