Take the 2-minute tour ×

Over the years I've seen many different ways of solving the problem of asking the user a simple yes/no question with a default value in the terminal. But in the interest of standardization, does any kind of standard for doing this exist ?

Some of the different ways I've seen, plus a few examples dug up by googling include:

... (Y,N) [N]? Y
... (Y/N) ?  [Default=Y]
... [Y/n]?
... ([y]/n)?
...? [y/[n]]
share|improve this question
And then there's the one that has no "y/n" at all, but defaults to "n". –  Ignacio Vazquez-Abrams Oct 18 '11 at 7:52
add comment

1 Answer

up vote 3 down vote accepted

Extensive googling and other forms of searching do not turn up anything on the matter, which leads me to believe that there is no such standard because, well, there is no point in standardizing something this trivial.

Standards usually exist to prevent people from writing custom protocols for everything and creating isolated islands of software that are not compatible with each other, and a yes/no question is something typically presented to a human user who is able to figure it out even if it's in a bizarre form like "... {Y3s\n0} !>".

If you really want to be as "standard" as possible, the following format seems to be the most common:

... [Y/n]

With the recommended/default option being capitalized, usually only requiring correct casing when no is the recommended option but.

share|improve this answer
add comment

Your Answer


