Skip to content
Conditionals and Selection
Computer Science · 6th Year · Programming Fundamentals · 2.º Período

Conditionals and Selection

Pupils introduce decision-making into their code using 'if-then-else' statements to respond to different inputs.

TL;DR:Conditionals and selection introduce 'intelligence' into coding. By using 'if-then-else' statements, 6th Year students enable their programs to make decisions based on inputs. This topic aligns with the Logic and Reasoning strand of the NCCA Mathematics curriculum and is essential for creating interactive digital content. It teaches students that computer behavior is not random but based on specific, logical conditions.

NCCA Curriculum SpecificationsPrimary Mathematics Curriculum (2023) - Logic and ReasoningPrimary Curriculum Framework - Being a Digital Learner

About This Topic

Conditionals and selection introduce 'intelligence' into coding. By using 'if-then-else' statements, 6th Year students enable their programs to make decisions based on inputs. This topic aligns with the Logic and Reasoning strand of the NCCA Mathematics curriculum and is essential for creating interactive digital content. It teaches students that computer behavior is not random but based on specific, logical conditions.

In an Irish context, this is a great way to explore real-world systems, such as how a thermostat decides to turn on the heating or how a traffic light in Dublin city centre changes based on a sensor. This topic empowers students to move from being passive consumers of technology to active creators who can design responsive systems. It is a cornerstone of the 'Being a Digital Learner' competency.

This topic comes alive when students can physically model the decision-making process through role-play and interactive simulations.

Key Questions

  1. How do computers make decisions?
  2. What is an 'if-then' statement?
  3. How can we make our games interactive?

Watch Out for These Misconceptions

Common MisconceptionThe 'Else' part is always necessary.

What to Teach Instead

Students often think they must fill both parts of an if-then-else block. Use a simulation to show that sometimes we only want something to happen if a condition is met, and do nothing otherwise.

Common MisconceptionComputers can 'think' for themselves using conditionals.

What to Teach Instead

Explain that the computer is only following the rules the programmer wrote. Use peer teaching to show that if the programmer's logic is wrong, the computer will make the 'wrong' decision every time.

Active Learning Ideas

See all activities

Frequently Asked Questions

What is the difference between an 'If-Then' and an 'If-Then-Else' statement?
'If-Then' is a single choice: if something is true, do an action. 'If-Then-Else' provides a backup plan: if the first thing isn't true, do something else instead. It's like saying 'If it's raining, take an umbrella' versus 'If it's raining, take an umbrella, else wear sunglasses'.
How do conditionals relate to the NCCA Science curriculum?
They are perfect for 'Designing and Making.' If students are building a circuit or a model, they can use conditional logic to explain how sensors (like a light sensor) trigger an output (like a bulb).
What are the best hands-on strategies for teaching conditionals?
Physical 'unplugged' games are best. Games like 'Simon Says' are essentially a series of conditionals. By modifying the rules of these games, students can see how changing a condition changes the entire outcome of the activity.
Can 6th Year students handle 'nested' conditionals?
Yes, if introduced visually. A nested conditional is just a decision within a decision (e.g., 'If it's the weekend, then (if it's sunny, go to the park, else stay home)'). Using flowcharts helps make this layering clear.
Edited by Adriana Perusin, Editor-in-Chief, Flip Education