# HG changeset patch # User Richard M. Stallman # Date 852796694 0 # Node ID ee4b53003fd53dccde92f4062d4162fe2e0e9670 # Parent ec7768e50ba8288164cf848ae8020c0c6394d0d1 Add when and unless. diff -r ec7768e50ba8 -r ee4b53003fd5 lispref/control.texi --- a/lispref/control.texi Wed Jan 08 14:59:41 1997 +0000 +++ b/lispref/control.texi Thu Jan 09 07:58:14 1997 +0000 @@ -143,8 +143,9 @@ @cindex conditional evaluation Conditional control structures choose among alternatives. Emacs Lisp -has two conditional forms: @code{if}, which is much the same as in other -languages, and @code{cond}, which is a generalized case statement. +has four conditional forms: @code{if}, which is much the same as in +other languages; @code{when} and @code{unless}, which are variants of +@code{if}; and @code{cond}, which is a generalized case statement. @defspec if condition then-form else-forms@dots{} @code{if} chooses between the @var{then-form} and the @var{else-forms} @@ -171,6 +172,38 @@ @end example @end defspec +@defspec when condition then-forms@dots{} +This is a variant of @code{if} where there are no @var{else-forms}, +and possibly several @var{then-forms}. In particular, + +@example +(when @var{condition} @var{a} @var{b} @var{c}) +@end example + +@noindent +is entirely equivalent to + +@example +(if @var{condition} (progn @var{a} @var{b} @var{c}) nil) +@end example +@end defspec + +@defspec unless condition forms@dots{} +This is a variant of @code{if} where there is no @var{then-form}: + +@example +(unless @var{condition} @var{a} @var{b} @var{c}) +@end example + +@noindent +is entirely equivalent to + +@example +(if @var{condition} nil + @var{a} @var{b} @var{c}) +@end example +@end defspec + @defspec cond clause@dots{} @code{cond} chooses among an arbitrary number of alternatives. Each @var{clause} in the @code{cond} must be a list. The @sc{car} of this