Hi..plz reply to this very basic question.
What is the syntax(function) for taking user input(numbers not strings ) in
ruby.
Thanks in advance.
Tanushree
Hi..plz reply to this very basic question.
What is the syntax(function) for taking user input(numbers not strings ) in
ruby.
Thanks in advance.
Tanushree
gets() returns Strings because that's how console i/o works,
but you can convert that to an number with String#to_i .
On 15/06/06, Tanushree Bhoi <tanushree.bhoi@gmail.com> wrote:
What is the syntax(function) for taking user input(numbers not strings ) in
ruby.
--
Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/
Thanks Dick.
On 6/15/06, Dick Davies <rasputnik@gmail.com> wrote:
On 15/06/06, Tanushree Bhoi <tanushree.bhoi@gmail.com> wrote:
> What is the syntax(function) for taking user input(numbers not strings )
in
> ruby.gets() returns Strings because that's how console i/o works,
but you can convert that to an number with String#to_i .--
Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/
--
Thanks & Regards
Tanushree Bhoi
Software Engineer
applabs Technologies
e-mail : tanushree.bhoi@applabs.com
:tanushree.bhoi@gmail.com
irb(main):001:0> require 'scanf'
=> true
irb(main):004:0> scanf("%d %s")
1 lemon
=> [1, "lemon"]
On 6/15/06, Tanushree Bhoi <tanushree.bhoi@gmail.com> wrote:
Thanks Dick.
On 6/15/06, Dick Davies <rasputnik@gmail.com> wrote:
>
> On 15/06/06, Tanushree Bhoi <tanushree.bhoi@gmail.com> wrote:
>
> > What is the syntax(function) for taking user input(numbers not strings
)
> in
> > ruby.
>
> gets() returns Strings because that's how console i/o works,
> but you can convert that to an number with String#to_i .
>
> --
> Rasputin :: Jack of All Trades - Master of Nuns
> http://number9.hellooperator.net/
>--
Thanks & Regards
Tanushree Bhoi
Software Engineer
applabs Technologies
e-mail : tanushree.bhoi@applabs.com
:tanushree.bhoi@gmail.com
Thanks Joey for your reply.
But when i am writting like this in my ruby irb.
scanf("%d %s")
its not responding.For require 'scanf' its giving 'true'.
I am using ruby 184-16.
Thanks
Tanushree
On 6/15/06, Joey <rubytalk@eachmapinject.com> wrote:
>
irb(main):001:0> require 'scanf'
=> true
irb(main):004:0> scanf("%d %s")
1 lemon
=> [1, "lemon"]On 6/15/06, Tanushree Bhoi <tanushree.bhoi@gmail.com> wrote:
>
> Thanks Dick.
>
> On 6/15/06, Dick Davies <rasputnik@gmail.com> wrote:
> >
> > On 15/06/06, Tanushree Bhoi <tanushree.bhoi@gmail.com> wrote:
> >
> > > What is the syntax(function) for taking user input(numbers not
strings
> )
> > in
> > > ruby.
> >
> > gets() returns Strings because that's how console i/o works,
> > but you can convert that to an number with String#to_i .
> >
> > --
> > Rasputin :: Jack of All Trades - Master of Nuns
> > http://number9.hellooperator.net/
> >
>
> --
>>
It's an input method - are you entering anything?
matthew smillie.
On Jun 15, 2006, at 14:06, Tanushree Bhoi wrote:
Thanks Joey for your reply.
But when i am writting like this in my ruby irb.
scanf("%d %s")
its not responding.
Yeah i know that Matthe.
I am entering values.
On 6/15/06, Matthew Smillie <M.B.Smillie@sms.ed.ac.uk> wrote:
On Jun 15, 2006, at 14:06, Tanushree Bhoi wrote:
> Thanks Joey for your reply.
> But when i am writting like this in my ruby irb.
> scanf("%d %s")
> its not responding.
>It's an input method - are you entering anything?
matthew smillie.
--
Thanks & Regards
Tanushree Bhoi
Software Engineer
applabs Technologies
e-mail : tanushree.bhoi@applabs.com
:tanushree.bhoi@gmail.com
From: Tanushree Bhoi [mailto:tanushree.bhoi@gmail.com]
> > But when i am writting like this in my ruby irb.
> > scanf("%d %s")
> > its not responding.
>
> It's an input method - are you entering anything?
[...]
Yeah i know that Matthe.
I am entering values.
OK, now try hitting 'enter'.
ben
-----Original Message-----
>On 6/15/06, Matthew Smillie <M.B.Smillie@sms.ed.ac.uk> wrote: