3 Types of Conditional Statements (If statements) NXT-G Programming


1.  Wait Block:  Do a one block command until a condition is met.

Wait Block Example:  Go forward unlimited until touch sensor activated.  Stop after Touch sensor activated.





2.  Switch Block (If - Else Statement):  If one condition is true, do one set of commands.  Else, do another set of commands.

Step by Step Directions for Switch Block Basic Line Follow Sample

Switch Block Example:  Line following:   If too dark, C motor runs and B motor stops.  If too light (else) B motor runs and C motor stops.



3.  Loop Conditional:  Repeat what is inside the loop until a condition is met. 

Loop Conditional Example:  Do the "Line Follow Program"
until the touch sensor is activated.  Then stop.

Email Mr.Michaud

Copyright ©2011 Mr. Michaud.