On 11-May-06, at 9:53 PM, corey konrad wrote:

>> because it needs to be a string when you print it.
>
> oh ok that makes sense, isnt there a getn method for getting number or
> other data types or do i always have to use gets?

You can use something like:

   num = Integer(STDIN.gets) rescue nil

or

   num = Float(STDIN.gets) rescue nil

which do conversions and deal with trailing garbage.

ratdog:~ mike$ irb
irb(main):001:0> Integer("    0xE84C\n")
=> 59468

I use these in quick and dirty scripts quite often, whether it's good  
form I don't know :-)

Mike

-- 

Mike Stok <mike / stok.ca>
http://www.stok.ca/~mike/

The "`Stok' disclaimers" apply.