© Jack Purdum 2015
Jack PurdumBeginning C for Arduino10.1007/978-1-4842-0940-0_5

5. Program Loops in C

Jack Purdum
(1)
Ecosoft, Inc., Cincinnati, Ohio, USA
 
One of the things computers can do more efficiently than humans is repetitive tasks. People get bored, and when that happens, their attention drifts and errors creep into the task at hand. Computers have the attention span of a gnat (i.e., none), so they are great at performing repetitive tasks. Unless a μc loses power or a component fails, they will loop forever, unless instructed to do otherwise.
In this chapter, you will learn
  • What makes a “good” program loop
  • How to use a for loop
  • How to use the while statement
  • How to use a do-while statement and its differences
  • Infinite loops
  • The break and continue ...

Get Beginning C for Arduino: Learn C Programming for the Arduino, Second Edition 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.