Professional Documents
Culture Documents
Loop, If Then, Hide and Show
Loop, If Then, Hide and Show
Success Criteria
• I can locate and insert the ‘show’ and ‘hide’ blocks in a script.
• I can locate the correct place for a sprite to appear visible.
• I can make a sprite invisible when it is not active in the code.
Instructing the Computer?
There are three main ways to control
how a computer will run the sequencing
instructions or commands you enter.
selection
repetition
Sequencing
A sequence of instructions tells the computer to run your commands in order, or
sequence, starting from the first one and finishing at the
last one.
The directions for getting from home
One everyday
to school are an example of a
example of a
sequence.
sequence is • Leave your house.
a recipe. • Walk down the path.
• Turn right.
Can you think of • Follow the road for 200 metres.
any more? • Turn left.
• Follow the road for 50 metres.
• Cross the road.
• Go through the school gates.
Selection “IF, THEN and ELSE “
Sometimes, we only want the computer to carry out commands if certain
conditions are met. We want to tell the computer to ignore some commands and
select other commands.
The words IF, THEN and ELSE are key words for using selection.
One everyday
example of repetition
would be traffic lights
which repeat the
same cycle of colours
over and over again.
Can you think of any
more?
Sequence, Selection and Repetition
Often all three of these are used together to make programs run as efficiently as
possible.
Can you think how these are used to control an automatic car
park barrier?
Sequence Selection
• barrier up • If ticket inserted, raise barrier.
• barrier down • If car has passed through, lower barrier.
Repetition
• ticket in
• barrier up
• wait
• barrier down
Show and Hide