Created
April 15, 2011 22:29
-
-
Save ilkerde/922581 to your computer and use it in GitHub Desktop.
Introducing: The OMG-EQUALS operator!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
There's this very pleasant and fulfilling moment in every developer's life | |
when it comes to comparing values. Especially testing for equality sometimes | |
is full of emotions. Sometimes, you don't want to "just simply" check if | |
values are equal. You want more. You want to express enthusiasm! Emotion! | |
Yeah, right, equals! You want | |
___ __ __ ____ _____ ___ _ _ _ _ ____ | |
/ _ \| \/ |/ ___| | ____/ _ \| | | | / \ | | / ___| | |
| | | | |\/| | | _ | _|| | | | | | |/ _ \ | | \___ \ | |
| |_| | | | | |_| | | |__| |_| | |_| / ___ \| |___ ___) | | |
\___/|_| |_|\____| |_____\__\_\\___/_/ \_\_____|____/ | |
I have good news for you. Your days of worry and limited equality expressiveness | |
are over. A new equality operator is born: the OMG-EQUALS operator! | |
Although I'll demonstrate it in C#, you can use OMG-EQUALS in many other languages, too! | |
*/ | |
// the boring, oldschool equals | |
if (true == true) | |
oldEquals = boring; | |
// the strong, delightful OMG EQUALS | |
if (true !=! true) | |
omgEquals = yeahOMG; | |
// the awesome, great, cheering OMG EQUALS | |
if (true ==!! true) | |
omgEquals = !!yeahOMG; | |
/* | |
Isn't this OMG?!? No longer "true == true", no longer "foo.Equals(bar)". | |
Instead, cheering, stunning, amazing "true !=! true". Lovely! :-) | |
And if you just want to express even more OMG, just use the "true ==!! true" notation! | |
I "created" the OMG-EQUALS operator not just for fun, but for purpose as well. :-) | |
Use it whenever you think that your equality test really requires emphasis and attention. :-) | |
Credit goes out especially to @rachelmyers and @coreyhaines for inspiring | |
me to think about the "OMG" type of equality :-) | |
references: | |
- http://twitter.com/#!/rachelmyers/status/56251400610529291 | |
- http://twitter.com/#!/coreyhaines/status/59019535449206784 | |
*/ |
YAY! This is exactly what I needed!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ZOMG! AWESOME!