âRepeat âsweep the floorâ 4 times.â
Thatâs exactly what a loop does.
đ¤ Robot Example: Blinking Lights
Letâs say your robot has an LED light.
To blink it 5 times, you could use a loop like:
Â
Repeat 5 times: Turn light ON Wait 1 second Turn light OFF Wait 1 secondÂ
Without loops, this would need 10+ lines of code! Loops make it simple.