Decision Making
At their most basic level, programs are written to accomplish simple sequences of behavior. For example, you might want your robot to drive forward and also make some turns to reach a destination. But, what if you want your robot to wait for the right time to start driving forward and complete its route? That would require programming with conditional statements. You would use a conditional statement to define what the "right time to start" is within your project. Maybe the "right time" is after a button is pressed or when a sensor detects a specific level and then it starts driving. When you watch the robot's behavior, it will seem like it is deciding when to start driving but it's because you set the condition for when driving should start.
Conditional statements are powerful programming statements that use a boolean (TRUE or FALSE) condition. Using the same example scenario as above, you could program your robot to repeatedly check if its Brain screen is pressed and drive forward when it is. The conditional statement in that project may read something similar to, "If the screen detects that it is pressed (TRUE), run the driving sequence." This statement does not mention any behavior if the condition is FALSE (the screen is not pressed) so the robot takes no action when FALSE. Conditional statements allow you to develop projects that have the robot behave differently depending on what it senses. For more information on Boolean Logic, click one of the following links (Google Doc / .docx / .pdf).
In the following example, if the Brain's screen is pressed (TRUE) the robot will drive forward. If the Brain's screen is not pressed (FALSE) the robot will stop driving. This shows the robot only driving forward when the Brain's screen is pressed, otherwise the robot stops.