Guy Dols <guy_dols / hotmail.com> writes:

> 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 think you are lying. Twice.

First, the answer is probably not what you're telling but rather:

22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222

Then it should NOT be 730, but what you get.

This is because for all we know, ask("") is returning "2" and 365
times "2" is a string containing 365 2s.  At least in such a inferior
language as Ruby.



In more strongly typed programming languages such as Common Lisp,
you'd get an error:

C/USER[929]> (* "2" 365)

*** - *: "2" is not a number



> i have an screenshot  as an attachment plz help me

Good for you!


-- 
__Pascal Bourguignon__