26
Flowchart of a branching algorithm
Textbook: pp. 69–71
GoalRead the flowchart of a branching algorithm: the condition in a diamond and the “yes” / “no” branches.
New words
diamond · rombyes · hano · yo‘qbranch · tarmoq
Explanation
In a flowchart a condition is written in a diamond. The diamond holds a question that can be answered only “yes” or “no”. Two arrows leave the diamond: one for “yes”, one for “no”. Only one branch is carried out at a time: you cannot go both right and left. A condition block is a diamond, a command block is a rectangle.
Worked examples
(Start) → ‹Is it raining?› → yes: [put on boots]; no: [put on shoes] → [go outside] → (End).
Two arrows leave a diamond, but only one leaves a rectangle.
Class activity
“Floor flowchart”: draw a diamond on the floor with two paths (“yes” and “no”). A child answers the question and walks along the right path: “Is it raining today?”
Practice
1
It is not raining. By the flowchart above, which footwear is worn?
shoes
2
How many arrows leave a diamond?
2
3
Can we do both branches at the same time?
No, only one