Repetition - Looping

Document Sample
Repetition - Looping Powered By Docstoc
					Repetition - Looping
           Control Structures
   Sequential
    • Do Together
    • Do In Order
   Conditions / Decisions
   Repetition / Loop
    • Counted
    • While Loop
                  Looping
   Repeating Behavior
    • Sequential Instructions
    • Methods
             Counted Loop
   Know how many times we need a
    block of instruction to repeat
    • Jump up and down 5 times
    • Uses a Counter
                Example
   Create a world with a Ferris Wheel.
    When the space bar is pushed, have
    the ferris wheel move around 5
    times.
               While Loops
   Repeating block of instructions
   Unspecified number of times
    • While a condition is true
    • While it is raining, use an umbrella
    • While the troll is more than 5 meters
      from the dragon, move toward dragon
     Ferris Wheel – While Loop
   Modify the ferris wheel program to
    continue going around until a switch
    is turned off.

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:0
posted:5/8/2013
language:Latin
pages:7