How Many Values Does a Boolean Have?

submited by
Style Pass
2024-12-28 22:00:03

A friend of mine recently had an interview for a software engineering position. They later recounted to me the content of the technical questions that they had been asked. Some had been pretty standard:

Innocuous at first, isn’t it? Probably a bit simpler, in fact, than the questions about methods and functions, concurrency and parallelism. It’s plausible that a candidate has not done much concurrent or parallel programming in their life, or that they came from a language in which functions were rare and methods were ubiquitous. It’s not plausible, on the other hand, that a candidate applying to a software engineering position has not encountered booleans.

If you’re genuinely unsure about the answer to the question, I think there’s no reason for me to mess with you. The simple answer to the question – as far as I know – is that a boolean has two values. They are true and false in Java, or True and False in Haskell, and 1 and 0 in C. A boolean value is either true or false.

So, what’s there to think about? There are a few things, ackshually. Let’s explore them, starting from the theoretical perspective.

Leave a Comment