Skip to content

Asking the robot a question

if, else, and why 1.4 is not a motor speed.

W1

A fork in the road

An if runs a block of code only when something is true. The thing in the brackets has to be a question with a true-or-false answer, and <, >, == and != are how you ask one.

An else is what happens when the answer was false. An else if asks a second question, but only when the first answer was false.

Card 1 of 6

1 / 6
Asking the robot a question · Robot On-Ramp