eintr: Loops & Recursion
11 Loops and Recursion
**********************
Emacs Lisp has two primary ways to cause an expression, or a series of
expressions, to be evaluated repeatedly: one uses a ‘while’ 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(1).
Menu