I'm very happy with using Jesse's interact library for user input: https://github.com/he-the-great/JPDLibs/tree/cmdln
Last time I've used it I combined it with std.conv since I needed either a number or a "q" from the user, e.g.: int input; auto line = userInput!string("Enter value:"); if (line == "q") { quit(); } else if (!throws!(ConvException)( { input = to!int(line); } )) // try converting to int { if (input >= -127 && input <= 127) { // do something } } Here throws() is just a custom function that asserts that a delegate throws.