Archives For true

true && false

Brian —  June 26, 2012 — Leave a comment

or is it True and False, …?

Boolean logic is just part of the job as a programmer.

However, language writers have  made our life complicated.

We don’t just have 0 and 1 for true and false.

We have types such as bool, Bool, boolean, Boolean.

We have true, True, TRUE, false, False, FALSE, 0, 1, non-zero, non-empty, NULL, … AARRG!!!!

It’s really not a big deal if you just program in one language. But who does that anymore?

I’m often programming in C++, C, perl, python, bash, javaScript, and PHP all in one day.

So what’s a person to do.

Personally, I set up vim colorization based on file extension such that the correct types get colored. And if I mess it up, it doesn’t get colored.

However, it’s still frustrating.

Anyone out there got a simple cheat sheet or mnemonic to keep it all straight?