Getting Started Previous page   Next Page

for

The for loop repeats a group of statements a fixed, predetermined number of times. A matching end delineates the statements.

The semicolon terminating the inner statement suppresses repeated printing, and the r after the loop displays the final result.

It is a good idea to indent the loops for readability, especially when they are nested.


Previous page  switch and case while Next page

© 1994-2005 The MathWorks, Inc.