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
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs