From: Paolo Negri Date: 2006-09-30T09:03:18+09:00 Subject: Re: "1".to_i *2 == 1 && "1".to_i*2 == 2 ? because the second version converts the given string in base 2. to_i accept an optional parameter which is the base of the integer (by default 10) http://www.ruby-doc.org/core/classes/String.html#M001463 '1'.to_i*2 calls the method * applied to the value returned by to_i '1'.to_i *2 is like '1'.to_i(*2) anyway a more common way to write the expression is '1'.to_i * 2 Paolo On 30/09/06, Giovanni Intini wrote: > Can anyone explain to me why > > "1".to_i*2 is equal to 2 > and > "1".to_i *2 is equale to 1? > > Thanks > Giovanni > >