Sometimes I have a function that should return true or false. But sometimes three possible values would make more sense.
In some language theses cases would be handled with integers or with exceptions.
For exemple you want to handle the age of a user if he is over 18 years old. And you have a function like this.
if(user.isAdult(country_code)){
//Go On
}else{
// Block access or do nothing
}
But in some case depending how your app is built I could see case where the birthday field is incomplete. Then this function should return something undetermined.
switch(user.isAdult()){
case true:
// go on
break;
case undetermined:
//Inform user birthday is incomplete
case false:
//Block access
}
As I said we can handle that with Exceptions and Int, but I would find it quite sexy to have a true, false, undetermined embeded in the language instead of using some home defined constants.