Skip to Main Content
The Art of LEGO MINDSTORMS NXT-G Programming
book

The Art of LEGO MINDSTORMS NXT-G Programming

by Terry Griffin
August 2010
Intermediate to advanced content levelIntermediate to advanced
288 pages
13h 21m
English
No Starch Press
Content preview from The Art of LEGO MINDSTORMS NXT-G Programming

the loop block

The Loop block lets you repeat a group of blocks over and over. The condition you set controls the number of times the loop is repeated.

A loop has two parts: the loop body and the loop condition. The loop body is the group of blocks within the loop. The condition tells the Loop block whether to run the loop body again or exit the loop and let the next block start. The condition is always checked after the loop body runs; therefore, the loop body is always run at least once.

As shown in Figure 6-13, the Loop block’s Control item gives you five ways to control how many times the body of the loop is run. Each option is discussed next.

Figure 6-13. Control options for the Loop block

  • Forever. The Loop will continue to run until the program ...

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.
Start your free trial

You might also like

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

Terry Griffin

Publisher Resources

ISBN: 9781593272180Errata