[comp.lang.misc] Easy to read conditions

martin@mwtech.UUCP (Martin Weitzel) (03/23/90)

In article <16249@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes:
>[.....]  I claim that, to me, the condition "(c >= 'a' && c <= 'z')" is a
>simpler expression than "(c < 'a' || c > 'z')".  I immediately recognize the
>idiom in the former, but the latter causes a perceptible delay as I mentally
>translate the condition.

Why not "('a' <= c && c <= 'z')" ?

This duplicates the mathematical notation "lowest <= x <= highest"
to specify a range very closely. It's equally easy to ready if you
want to exclude one of the limits from the range - simply change
"<=" to "<".
-- 
Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83