Function userInput

The userInput function provides a means to accessing a single value from the user. Each invocation outputs a provided statement/question and takes an entire line of input. The result is then converted to the requested type; default is a string.

auto name = userInput("What is your name");

Prototype

T userInput(T)(
  string question = ""
);

Returns

User response as type T.

Where type is bool:

true on "ok", "continue", and if the response starts with 'y' or 'Y'.

false on all other input, include no response (will not throw).

Throws

NoInputException if the user does not enter anything. ConvError when the string could not be converted to the desired type.

Authors

Jesse Phillips

Copyright

Copyright Jesse Phillips 2010

License

zlib/libpng