From: Chris Thiel Date: 2007-07-27T09:10:56+09:00 Subject: Re: beginner Q. ------=_Part_171404_2977694.1185495058556 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/26/07, jpywtora@calpoly.edu wrote: > > I don't know about hh's implementation but how about > > irb(main):003:0> print "foo:"; gets().split > foo:this is a test > => ["this", "is", "a", "test"] > > Also, look at highline at http://highline.rubyforge.org/ > -- > Johnny P > > --- Original Message --- > > So, when i first started to learn ruby *about a week or two > > ago*, my > > cousin *who showed me ruby* had me start on a program called > > hackety-hack, which is i type of tutorial thing, it kind of > > gives > > programs a sort of gui also. But i have noticed you cant do > > some of the > > same commands as on the irb main. In hackety-hack there was > > an > > *ask* command, so you could do things like > > var = ask("how old are you")... > > > > Im wondering if/ or what is the acctual *ask* command?? Because > > im > > trying to write a program for my dad *a chef* which vendors > > have the > > cheapest prices, and its getting annoying writing out all their > > prices > > into 2 different arrays. it would be nice if it could be like > > Array_1 = ask("put in the 1st vendors prices) > > Array_2 = ask("put in 2nd vendors prices) *and then i could > > go on and > > subtract the two arrays* > > > > Sorry if this is a totaly idiotic question :(!? > > Much thanx for anyones help! > > -- > > Posted via http://www.ruby-forum.com/. > > To clarify: irb(main):006:0> def ask(question) irb(main):007:1> puts "#{question}:\n" irb(main):008:1> gets.split irb(main):009:1> end => nil irb(main):010:0> answer = ask("Enter 1st vendor's prices") Enter 1st vendor's prices: $1 $2 $3 $4 => ["$1", "$2", "$3", "$4"] irb(main):011:0> answer => ["$1", "$2", "$3", "$4"] irb(main):012:0> Although I'd have to point out that 'ask' is an awful name for a method. Chris ------=_Part_171404_2977694.1185495058556--