Not much, aside from being easier to extend if additional conditions are expected in the future. Other than that, its more of a style choice.
With you on that .... though ....
In my opinion, (if) is better in this case because it is less likely to be misunderstood. However, I would write it more succinctly:
(foreach n (if (= f ".") (cddr Dirs) Dirs)
If you take Owen's post into account, a cond would probably sort out both scenarios. Easier to extend, yet still readable without special knowledge of how Lisp operates.
The only difference I see is that
- 'and' returns T or nil
- 'if' returns nil or the new value of 'Dirs'
That's actually a peculiarity of AutoLisp. In all other Lisps (at last those I've used) there would be asolutely no difference in this case. The and would return the exact same thing as the if does.
but 'foreach' does not care about it ...
Exactly. Any boolean test in Lisp (all types of Lisps) is a situation of: "Is it something else than nil? If so consider it true, else consider it false."