program flow control 2
TRANSCRIPT
Program Flow Control 2
Recap
• Sequence, Selection and Iteration looked at in Program Flow Control 1
• Shapes used :
Case
• Useful for showing a series of if..then..elsestatements where more than 2 options exist
– ie what Lego shall I buy? would have a different Lego model
• The True line always flows to the right and the False line goes to the next decision
Case in action
Shall I buy
Castle Lego?
Shall I buy Star
Wars Lego?
Shall I buy City Lego?
Buy Castle Lego
Buy Star Wars Lego
Buy City LegoBuy no Lego
YES
NO
YES
YES
NO
NO
Do-while
• Used for containing a process in a loop until it is completed
Do-while in action
Buy Cake
Do you want
more?
NO
YES