From: Tom Cloyd Date: 2009-03-04T09:19:39+09:00 Subject: Re: fixnum problem plz help Pascal J. Bourguignon wrote: > Guy Dols 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! > > > And for the benefits, such as they are, of strong typing, we get to a whole other level of detail to attend to. No thanks. Did that for a time with Pascal. I prefer the mindless grace of waterfowl. t. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist Bellingham, Washington, U.S.A: (360) 920-1226 << tc@tomcloyd.com >> (email) << TomCloyd.com >> (website) << sleightmind.wordpress.com >> (mental health weblog) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~