I get to program in crummy coldfusion where we have nifty boolean operators like EQ, NEQ, GT, LT, GTE, LTE and you can use "yes" and "no" in place of TRUE or FALSE.
I found some old code that used the following logic and I cringed:
<cfif form.not_admin NEQ 0>
My brain melted on my desk while I tried to figure out what the intent was there.
Hah, is that triple-reverse boolean logic?
But yeah, my similar "boolean woe" story: Ruby doesn't even have Booleans. Stuff can be Truthy or Falsy, but there is no object of type "Boolean". I got lulled into a trap the other day by a Gem we are using at work for a Rails app we're developing (Gems are like external libraries or packages, for the non Ruby/Rails savvy folks out there). Anyways, I was speccing out a controller and was trying to assert that a value should have been of type boolean and equal false, as this Gem provided a "Boolean Type." My test for "should equal false" passed, but the object type caused an exception, claiming "Unintialized Constant Boolean." After some inspection, the object's type was FalseClass. Of course, this was not a problem that couldn't be fixed by coffee, refactoring and the act of cursing controller tests. But yeah, if you load up a Ruby or Rails console and use the .class function on anything, it returns the class of the object (I think it's like getClass() in java). So, when I did a few tests ("hi".class will return "String", 1.class will return "Integer", etc), I found out that true's class is TrueClass and false's class is FalseClass. Not sure if that helps anyone, but it helped me!















