`maybe` value.

Sometimes you call a function that is supposed to return a boolean, but maybe you pass in contradictory options or information, or the function cannot figure out whether it's true or false. This is where maybe could come in. Maybe you passed in information of the wrong type, and don't know and pushed to production immediately. If your function throws an error, it might break. It could instead return something like maybe or unknown or notapplicable.

If the user is expecting a boolean, they'll be using truthiness to branch, so any value other than true or false could break - an exception is appropriate here, because you want your program to crash when you aren't prepared to handle an unexpected result.

3 Likes

A lot of people use null for this purpose, but this is semantically incorrect, and since people use null for it that means that this would have a practical use and it should have its own value: maybe.