Science / Grades 3-6
Programming basics: choose a branch
Learning goal: Use an IF/ELSE flowchart and test the exact boundary of a condition.
Before you start: Compare whole numbers and follow one instruction at a time.
Read or print this lesson What to practiceThe video could not load. The transcript is still available below.
Next: your worksheet
Programming Basics: Choose One Branch
Checking sign-in...
Read the transcript
Saved reading place
Video transcript and practice. Reading or printing does not count as playback time or an assessed grade.
1. A program can choose a path
Video: 0:00

Programs can choose what to do by checking a condition. A condition is a question with a true or false answer. Our example asks whether points is at least five. That answer selects one of two paths through the drawing.
2. Read the comparison carefully
Video: 0:17

The comparison symbol means greater than or equal to. We can read it as at least five. Six meets that rule, and so does five itself. Four does not. The equal part is small on the page but important to the answer.
3. Follow the true path
Video: 0:36

In our pseudocode, if points is at least five, the program shows the word ready. This is the true branch. Start at the condition and follow the arrow labeled true. It leads to one display action, not to both actions.
4. Follow the other path
Video: 0:54

If the condition is false, the program shows practice instead. That is the else branch. With four points, follow the false arrow. The program has not become moody; it is following the rule we wrote for that value.
5. Pause at the boundary
Video: 1:11

Pause and predict what appears when points is exactly five. This value sits right on the boundary between the two outcomes. Do not guess from the size of the number. Read every part of the comparison, including the equal sign.
6. Equality belongs on this side
Video: 1:29

Five is equal to five, so greater than or equal to is true. The program shows ready. If we had written only greater than five, this same input would take the other path. Testing the boundary helps reveal that kind of mistake.
7. A branch can remain unused
Video: 1:48

Fun fact: a program can contain a branch that a particular run never uses. In this if and else example, only one branch runs for each check. Trying only large point values would leave the practice branch untested. Different inputs help explore different paths.
8. Check both sides of the rule
Video: 2:09

Trace four, five, and eight points before moving on. For each value, say whether the condition is true and which word appears. Then continue to the worksheet. The words are part of a fictional example, not a rule that changes your actual learning grade.
Show your understanding
You can point, explain aloud, draw or write.
- Choose the IF or ELSE branch by testing the condition.
- Test the exact boundary and explain why only the selected branch runs in the example.
Try it yourself
Pause and trace the instructions before checking the answer.
Continue to the matching worksheet. These examples use teaching pseudocode, not code to paste into a computer.
Next: your worksheet
Programming Basics: Choose One Branchhttps://s3u.com/sc470
Lesson: https://s3u.com/lessons/programming-choices