13
votes
Vote UpVote

Cleanup your ugly Boolean expressions with De Morgan’s laws

DelphiTools – This is a simple trick that can be handy to cleanup or simplify Boolean expressions, and is always good to have in your code-writing toolchest: De Morgan’s laws. These two laws allow to apply a negation to an and or or expression: (not A) and (not B) <=> not (A or B) (not A) or (not B) <=> not (A and B) So basically when you distribute a not, an or becomes an and, and vice-versa. Also keep in mind some simple comparison negation rules: not (A < B) <=> (A >= B) not (A > B) <=> (A <= B) Exemple: testing if a TRect overlaps another TRect Now, I ...
Favorite? Off-Topic? Eric @ 2013-01-15 12:54

Statistics

Visits: 1429
Votes: 13
Favorites: 1
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Ericc
François
Jason McMillen
Jørn E. Angeltveit
Kyle A. Miller
LukaL
Ph. B.
Radosław Kokoć
Ravaut123
Robert Love
Tier777
Zzzzz
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)