S3U

Science / Programming basics / Grade 4 / sc470

Programming Basics: Choose One Branch

Use a true-or-false condition to choose an action.

All worksheets
5 questions0m 0s
Learn the skill

IF checks a condition. In this pseudocode, IF points >= 5 THEN SHOW ready ELSE SHOW practice END runs exactly one branch. The symbol >= means greater than or equal to. SHOW only displays text.

Worked example

With points = 5, the condition points >= 5 is true, so ready is displayed. With points = 4 it is false, so practice is displayed. The equality case belongs in the true branch.

Check whether points is at least five. True displays ready; false displays practice. A value of exactly five takes the true branch.
Check whether points is at least five. True displays ready; false displays practice. A value of exactly five takes the true branch.
Question 1 For points = 5, what is displayed?
Question 2 For points = 4, what is displayed?
Question 3 For points = 8, is points >= 5 true?
Question 4 How many branches run for one check of this IF/ELSE?
Question 5 Which input best checks the exact boundary?