Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Emacs Lisp has two primary ways to cause an expression, or a series of
expressions, to be evaluated repeatedly: one uses a
loop, and the other uses recursion.
Repetition can be very valuable. For example, to move forward four sentences, you need only write a program that will move forward one sentence and then repeat the process four times. Since a computer does not get bored or tired, such repetitive action does not have the deleterious effects that excessive or the wrong kinds of repetition can have on humans.
People mostly write Emacs Lisp functions using
while loops and
their kin; but you can use recursion, which provides a very powerful
way to think about and then to solve problems(8).
Causing a stretch of code to repeat. 11.2 Save your time:
11.3 Recursion Causing a function to call itself. 11.4 Looping Exercise
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|