If I have true i/o false or vice versa, is it an OBOE?

Posted by Protector one on Programmers See other posts from Programmers or by Protector one
Published on 2014-06-12T09:05:40Z Indexed on 2014/06/12 15:39 UTC
Read the original article Hit count: 144

Filed under:
|

I often make the mistake of inverting my truth values in my code (e.g. in my if clauses). It gives me the same feeling as when making an OBOE (Off By One Error), even though it's technically not. Would you call it an OBOE, or better yet, is there a specific term for "off by truth value"-errors?

My reasoning is that all possible values of a boolean are true and false. In other words, the possible values are contained in the array: [true, false]. If you access this array by index, you'll always be off by one… when selecting the wrong one. This becomes especially obvious when you calculate your index as: index = someInt % 2.
Now I understand that this usually not the case, but in my mind, it always feels like this. Almost got it, just off by one…

© Programmers or respective owner

Related posts about terminology

Related posts about errors