Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In programming what do you call a choice that is not Boolean?

ie. a Boolean condition is a true/false, either-or possibility.

What do you call a condition with one or more possibilities? And, is there any difference if the condition is zero or more versus one or more?



To add some clarity:

Specifically I'm having a hard time when describing certain types of algorithms to non-programers. I'm a hobbyist programmer so I lack a lot of the vocabulary that comes with a computer science degree.

If I present a user with an "either-or" choice, I find the users understand what I mean if I call this a "boolean" choice, even if it has more than two possibilities.

For example: "Pick a color: red, yellow, green, or blue."

If I have something that's a "one or more" choice I don't know what to call that.

For example: "Select any colors that you like: red, yellow, green, blue."

How do you (knowledgeable programmers) refer to these kinds of choices when you talk about them?


As was pointed out in the comments I shouldn't even be saying "Boolean", I should be saying "Binary." That makes perfect sense...

So, is there such a thing as "polynary"?

share|improve this question

closed as off-topic by gnat, MichaelT, GlenH7, World Engineer Oct 28 '13 at 22:45

  • This question does not appear to be about software development within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

an enum that's selected with a switch? – iterationx Jul 19 '11 at 21:53
TRUE, FALSE, FILE_NOT_FOUND - theDailyWTF logic! – Jarrod Roberson Jul 19 '11 at 22:04
"Opposite" is such a misleading word in this case... – Mark Canlas Jul 19 '11 at 22:25
Boolean is not an "Either/or" it is True/False. BINARY is a choice between two options. – JohnFx Jul 19 '11 at 23:38
This question appears to be off-topic because it is a "name that thing" question. "Name that thing" are bad questions for the same reasons that "identify this obscure TV show, film or book by its characters or story" are bad questions: you can't Google them, they aren't practical in any way, they don't help anyone else, and allowing them opens the door for the asking of other types of marginal questions. See – gnat Oct 26 '13 at 22:25
up vote 1 down vote accepted

Specifically I'm having a hard time when describing certain types of algorithms to non-programmers.

I'm not sure if computer science terms will help you with this : )

For example: "Pick a color: red, yellow, green, or blue."

The layman would call it a "multiple-choice question." Like those scangrade questions where you fill in the answer with a Number 2 pencil.

For example: "Select any colors that you like: red, yellow, green, blue."

I would call that "multiple-select question." Choice implies a single decision, but selection generally allows for including multiple objects.

share|improve this answer
Cartoon illustrating a scangrade test. – idbrii Jul 19 '11 at 23:47
+1 for the cartoon, lol – Andrew Jul 20 '11 at 0:26
I think this is the best way to describe it to non-programmers. Thanks! – Andrew Jul 20 '11 at 16:23

When you have the possibility to refer to one or more values, you could call this options.

An implementation of this in e.g. C# is using a flags enum.

enum SelectedColor
    None, Red, Yellow, Green, Blue

SelectedColor colors = SelectedColor.Red | SelectedColor.Green;

This uses an underlying value type where every bit of the value represents one possible option. E.g. when the underlying value type is an Int32 you can specify 32 separate possible options.

0000 = None
0001 = Red
0010 = Yellow
0100 = Green
share|improve this answer

It's usually called a "switch" - like this one in C#

It lets you choose between many possibilities. You could even write one that had just two choices like an if statement.

int caseSwitch = 1;
switch (caseSwitch)
    case 1:
        Console.WriteLine("Case 1");
    case 2:
        Console.WriteLine("Case 2");
        Console.WriteLine("Default case");
share|improve this answer
Switch is good -- but doesn't that still usually mean you pick one of the possible cases rather than possibly many of the cases? What do you call the logic where many possibilities may happen, not necessarily one or the other? – Andrew Jul 19 '11 at 21:57
@Andrew - Ah. You can code a switch so that many values execute the same code, but there has to be a single value executed at any one time. Perhaps you need to clarify your question. – ChrisF Jul 19 '11 at 21:59

If I have something that's a "one or more" choice I don't know what to call that.

In the content management system we have where I work this would be called a "Pick list" to select the values where if one wanted to see the raw value it is a pipe-delimited list of a GUIDs. "Sets" would be the Mathematical construct you seem to be using here as one could do a check of MyColors.Count > 0 for a Boolean check on if there is are some items in the MyColors variable. There is also methods like Contains to check if a set, often called a collection or list which could be implemented using arrays or linked lists, has a specific member or not in some languages.

Hopefully that is what you mean. Short-circuit evaluation comes to mind as an area where one can have an "I don't care" situation in some cases.

share|improve this answer
+1, the mathematical set sounds very relevant to me – Steven Jeuris Jul 19 '11 at 22:29

By definition, a boolean can only be either true or false, 1 or 0. There's nothing confusing about that. In terms of explaining to a user your situation: "Pick a color: red, yellow, green, or blue." It is simply a single choice from a set of colours.

Contrast this with: "Select any colors that you like: red, yellow, green, blue." This is simply said to be multiple choices from a set of colours.

Neither of these situations are boolean equivalent options. You can argue that the decision to make a choice is, in and of itself, a boolean operation: you either choose a value, or you don't.

I'm not entirely sure if this is what you're trying to get at, but I suppose that's how I see booleans.

share|improve this answer
Yeah that makes sense. I think where Boolean comes from is "you either picked red or you didn't," whereas I'm not sure how to describe the logic of "you could have picked zero, one, or many options". – Andrew Jul 19 '11 at 23:20

Are you perhaps referring to a Bit Field? It's generally represented as an Enumeration with fixed binary position values, which can be used to specify 0...n combinations of values.

share|improve this answer

When talking of what an operation returns, I'd distinguish between here between scalar and set-wise return types.

When talking instead of what an operation demands—that is, its parameters—I'd characterize its arity as monadic (exactly one), dyadic (exactly two), or polyadic (any nonnegative number, as is customary with a count). Alternatly, one could use unary, binary, and n-ary, respectively.

share|improve this answer

In Java you would have a Set of enum values. Under the bonnet it uses a bit map.

enum Colour { Red, Blue, Yellow, Green }

Set<Colour> colours = EnumSet.of(Colour.Blue, Colour.Green);

if (colours.contains(Colour.Yellow)) {


[Red, Blue, Green]
share|improve this answer

So, is there such a thing as "polynary"?

I would use the word "discrete", as in "a set of discrete options."

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.