From: "Brian Schröder" Date: 2005-08-12T22:57:03+09:00 Subject: Re: Another newbie question On 12/08/05, daz wrote: > > len wrote: > > > > How do I request input from the user such as: > > > > >>Please enter dollar amount: > > > > I would like the prompt to display and the user to be able to enter the > > data after the prompt. I thought "gets" would do it but I don't > > understand how to get the prompt to display. > > > > > STDOUT.sync=true > print '>> Please enter amount: $' > resp = STDIN.gets.chomp > puts resp # echo input > puts "\nYour acount balance is below $" << resp << " :-?" > > #-> Please enter amount: $12 > #-> > #-> Your acount balance is below $12 :-? > > > daz > > > > > Or use the readline library, there you can even supply the prompt and you get a ton of extras. regards, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/