A dime for a nickle - use the power of the "or"

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

A dime for a nickle - use the power of the "or"

Post by newdep »

When you always want to have a return value of 'true
even though the result is 'nil use the power of the "or"


(and
(I-return-true)
(or (I-could-return-nil-function) 'true)
(i-could-be-next))


That will always return true!

Why this stupid trick?

... depends on your way of programming,
but if you use a lot of "and' , "when" to compare results
its sometimes needed to force a 'true to make sure the
whole evaluation is completed, instead of popping out at 'nil.


;-)
-- (define? (Cornflakes))

Locked