conclusion
The flow of your program is as important as the configuration of the blocks. You use the Switch block to make decisions, allowing you to choose between two groups of blocks. By nesting Switch blocks, you can extend the number of choices, as in the LineFollower2 program.
The other major flow control block is the Loop block, which allows you to repeat a group of blocks until a certain condition is reached. Much of the power of the NXT-G language comes from the flexibility you have in specifying the conditions for both of these blocks. The condition is usually based on a sensor reaching a set trigger value, although you can also configure the Loop block to repeat for a certain number of repetitions or a set amount of time.
You can also use ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access