What could be simpler than a bit? It's either a One or a Zero. True or False. Yes or No. On or Off. High or Low. Whatever you call it, it can only one thing or another. Yet somehow, there are some programmers who still have a hard time grasping this concept. Let's take a look at their attempts at mastering this beast.

First, there's Rob Henry's senior (as in title, not age) colleague, who seems to have a problem with the fact that "True" and "Not False" are one in the same:

  var isIE=document.getElementById&&document.all;
  var isNotIE=document.getElementById&&!document.all;

Next up is from JamesCurran, whose predessesor found perhaps the most confusing way of testing a Boolean value:

  if (!Page.IsPostBack == true)

Maybe doing that in real life could help ... but hunnie, when I asked if you if you would say "yes" to if I could not go out with the guys, you said "yes"!!. But I'm not sure how much this curious ASP/VBScript snippet from Jason Millar would help ...

  If request("chkFieldValue") = "ON" or "ON" = "ON" Then
  End If

And finally, we have some interesting code from Mike Kolter that, in addition to only awarding benefits to the tenth and twentieth former spouse, seems to have a similar misunderstanding of the "if it's not one, then it's the other" ...

  //Only a member, spouse or ex-spouse can have money rolled over To ROLLOVER Organization 
  if l_int_no_of_rollover > 0 then 
    if CodeSplitAccountRelationShip.IsMember 
      or CodeSplitAccountRelationShip.IsSpouse 
      or CodeSplitAccountRelationShip.IsExSpouse10 
      or CodeSplitAccountRelationShip.IsExSpouse20 then 
      TApplicationError.AddApplicationError('PR0040', FApplicationErrorCollection); 

  //Only a member can have money rolled over to TRUST 
  if l_int_no_of_trust > 0 then 
    if CodeSplitAccountRelationShip.IsMember then 
      TApplicationError.AddApplicationError('PR0062', FApplicationErrorCollection); 

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!