On Tue, 03 Mar 2009 16:28:48 -0500, Guy Dols wrote:

> hy
> 
> i am new to ruby i am trieng to get some skils but i have a problem when
> i use a fixnum :
> 
> years = ask("")
> days = years * 365
> puts days
> 
> 
> my answer is
> 
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
> 
> but i should be 730
> 
> i have an screenshot  as an attachment plz help me

Ask is returning the string "2" instead of the number 2.
When you use the multiplication operator on a string, it creates a longer 
string with that many copies of the string concatenated back to back, so 
instead of multiplying the number 2 by 365 to give 730, you got a string 
containing exactly 365 twos.

years=ask("").to_i

--Ken

-- 
Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/