Chapter 8

Loops

The objectives of this chapter are to enable you to learn to:

ent Program (or code) determinate loops with for

ent Program (or code) indeterminate loops with while

In Chapter 2 we introduced the powerful for statement, which is used to repeat a block of statements a fixed number of times. This type of structure, where the number of repetitions must be determined in advance, is sometimes called determinate repetition. However, it often happens that the condition to end a loop is only satisfied during the execution of the loop itself. Such ...

Get Essential MATLAB for Engineers and Scientists, 5th 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.