STDIN.gets() with default value?

Hello ruby-forum community,

is there a way to give STDIN.gets() a default value?
The user should see a value by gets() and can edit this or just press
enter

I believe that the standard way to use a default is to state what the
default is, and evaluate blank input ("\n") as the user choosing the
default option. In the event of multiple choices you would usually
provide a list of options.

I’m not sure if it’s possible to print a value into the user’s input
line.

On Sep 26, 2013, at 3:51 AM, dee kay [email protected] wrote:

Hello ruby-forum community,

is there a way to give STDIN.gets() a default value?
The user should see a value by gets() and can edit this or just press
enter


Posted via http://www.ruby-forum.com/.

Specifically that, no, but you should look at the highline gem for
dealing with this sort of thing.