Package: alexandria

Macro if-let

Lambda List

if-let (bindings &body (then-form &optional else-form))

Details

Creates new variable bindings, and conditionally executes either then-form or else-form. else-form defaults to nil.

bindings must be either single binding of the form:
(variable initial-form)  
or a list of bindings of the form:
((variable-1 initial-form-1)
 (variable-2 initial-form-2)
 ...
 (variable-n initial-form-n))  
All initial-forms are executed sequentially in the specified order. Then all the variables are bound to the corresponding values.

If all variables were bound to true values, the then-form is executed with the bindings in effect, otherwise the else-form is executed with the bindings in effect.
 

See also