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]]
We form yes-no questions with an auxiliary verb (be, do or have) + subject + main verb or with a modal verb + subject + main verb: Be: Is she working very hard? Were they travelling together? Do: Does that taste okay?
You can answer with a simple “yes” or “no.” But, suppose you wanted to answer with something a little longer. When we answer yes or no questions, we do not usually repeat the full question. Instead, we answer with the auxiliary or modal from the question.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With