How to finish the Random Rectangles lesson using only a while loop in code.
You can try this solution; I implemented it using a while loop and an if statement. Please take a look.
while (!isBlocked()) {
moveForward()
if(isBlocked())
turnLeft()
if(isOnClosedSwitch())
toggleSwitch()
}
1 Like