(lispref.info)Control Structures

Next: Variables Prev: Evaluation Up: Top

Control Structures

   A Lisp program consists of expressions or "forms" (Note: Forms.).
We control the order of execution of the forms by enclosing them in
"control structures".  Control structures are special forms which
control when, whether, or how many times to execute the forms they

   The simplest control structure is sequential execution: first form
A, then form B, and so on.  This is what happens when you write several
forms in succession in the body of a function, or at top level in a
file of Lisp code--the forms are executed in the order they are
written.  We call this "textual order".  For example, if a function
body consists of two forms A and B, evaluation of the function
evaluates first A and then B, and the function's value is the value of

   Naturally, Emacs Lisp has many kinds of control structures, including
other varieties of sequencing, function calls, conditionals, iteration,
and (controlled) jumps.  The built-in control structures are special
forms since their subforms are not necessarily evaluated.  You can use
macros to define your own control structure constructs (*note

* Sequencing
Evaluation in textual order.
* Conditionals
`if', `cond'.
* Combining Conditions
`and', `or', `not'.
* Iteration
`while' loops.
* Nonlocal Exits
Jumping out of a sequence.

automatically generated by info2www