TalentJR apps
An if / else lets a robot choose using a sensor. In “if (distance < 20) { turn right } else { go forward }”, the robot checks the distance sensor: if the reading is less than 20 cm it turns away, otherwise it drives on. Exactly 20 is not less than 20, so the else part runs. A while loop keeps repeating while its condition is true: “while (distance > 20) { forward 10 cm }” drives closer and closer, then stops.
✓ You passed this lesson’s test.
True → if, false → else — “put the sensor reading into the condition; only one part runs”
Use it for: Obstacle-avoiding robots, robot vacuums, coding lessons on conditions and robotics competitions.
Check: A reading of 25 cm would make the robot go forward ✓
▶ Watch it animatedWork it out in your head or on paper, type the answer and press Check. Stuck? Press “Show me how”.
Right: 0 · Tried: 0
20 questions. Check each answer, then go to the next one. Get 16 or more right to pass.
🏅 Sign in with Google to earn the 🚧 Obstacle Dodger badge when you pass — and a certificate when you finish all 10 lessons of Part 3 · Programming robots. You can still take the test without signing in.
Why does it work? When should you use it? Ask in English, मराठी or हिंदी.
Sign in with Google to ask Free — 20 questions a day.
Prefer a real teacher? TalentJR teachers take live online classes anywhere in India and visit homes in selected cities. Tell us what you need and our team will call you with timings and fees.