DEV Community

Calin Baenen
Calin Baenen

Posted on

Does yes and no have a "type name", like how true and false are called "boolean"?

Do "yes" and "no" have a name together, like how "true" and "false" are called "boolean"?

Top comments (9)

Collapse
 
assaf profile image
Assaf Arkin

You can use whatever labels you want for Boolean: true/false, yes/no, 1/0.

If you have three values - true, false, unknown - that’s trinary or three-value logic: en.wikipedia.org/wiki/Three-valued...

Collapse
 
calinzbaenen profile image
Calin Baenen

For context, I'm using a language without nullable types, and I want a class that uses the values: "YES", "NO", "NEITHER".

Collapse
 
patricktingen profile image
Patrick Tingen

You might also need a value for "unknown", depending on your situation of course

Collapse
 
egilhuber profile image
erica (she/her)

What language?

Collapse
 
calinzbaenen profile image
Calin Baenen

GoLang

Collapse
 
calinzbaenen profile image
Calin Baenen

Also no, I'm not counting interface/pointer/etc... types as nullable.
Nil is not null, and I think that distinguishment needs to be made.

Collapse
 
rami profile image
Raam

Determinators

Collapse
 
calinzbaenen profile image
Calin Baenen

I like this answer.

Collapse
 
rami profile image
Raam

You're welcome.