- :
-
Topics Covered
Loop with Count Control
Lesson Links
...
Check Your Understanding:
1. A Repeat Loop block will send the Program Flow backā¦
Every time, forever.
Only a limited number of times
If the Touch Sensor is not pressed when the Flow reaches the end of the Loop
If there is nothing after the Loop
2. What does it mean for a Loop to be "Conditional?
It only sends the Flow back under certain conditions
The entire Loop can be skipped under certain conditions
The Loop runs faster after it is trained, or "conditioned"
The code runs every time, no matter what
2. What is the "condition" in this Loop based on?
The distance the robot has traveled
The value of the Touch Sensor
The number of times the Loop has sent the Flow back
The number of seconds the Loop has been running
Try It!
Try it!
1
Changing Loop Count
Try changing the number in the Loop's Count setting to
2
, then running the program.
Try it!
Virtual Robot
ChangeLoopCountVR.rbg
Physical Robot
ChangeLoopCount.rbg
What happens?
The robot moves forward then back, twice, then stops.