Back: Conditionals
Forward: Diversions
 
FastBack: Diversions
Up: Features of M4
FastForward: Writing macros within the GNU Autotools framework
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

21.4.4 Looping

There is no support in M4 for doing traditional iterations (ie. `for-do' loops), however macros may invoke themselves. Thus, it is possible to iterate using recursion. The recursive definition can use conditionals (21.4.3 Conditionals) to terminate the loop at its completion by providing a trivial case. The GNU M4 manual provides some clever recursive definitions, including a definition for a forloop macro that emulates a `for-do' loop.

It is conceivable that you might wish to use these M4 constructs when writing macros to generate large amounts of in-line shell code or arbitrarily nested if; then; fi statements.


This document was generated by Joost van Baal on August, 23 2005 using texi2html