Chapter 10. data wires and the loop block

In this chapter, you’ll learn how to use two special features of the Loop block that were designed to be used with data wires. The Loop block’s Logic mode gives you flexible control over when the Loop block finishes, and the Loop Index output tells you how many times the loop completed.

logic mode

The Loop block’s Logic mode lets you choose when to exit the loop using a Logic value from a data wire. Figure 10-1 shows how a Loop block looks with Logic mode selected and a data wire attached. After the blocks in the loop body run, the value on the data wire is checked. If the value is false, the loop continues and repeats the blocks in the body. If the value is true, the loop exits. The Loop condition is always ...

Get The Art of LEGO MINDSTORMS EV3 Programming (Full Color) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.