clojure.core/if-let¶
bindings => binding-form test
If test is true, evaluates then with binding-form bound to the value of test, if not, yields else
Examples¶
Note by gstamp¶
The difference between when-let and if-let is that when-let doesn't have an else clause and and also accepts multiple forms so you don't need to use a (do...).
Note by DerGuteMoritz¶
I wonder what motivates the restriction of only one binding, e.g. many Schemes implement an and-let* form which allows multiple bindings, evaluating them in order and breaking out on the first binding that evaluates to false. Can somebody shed some light on this?
See also¶
Content from the matching ClojureDocs page, with authors credited on each contribution.