[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: "1".to_i *2 == 1 && "1".to_i*2 == 2 ?

Eric Hodel

9/30/2006 7:38:00 PM

On Sep 29, 2006, at 4:47 PM, 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?

This is why you should run with -w as often as possible:

$ ruby -w
"1".to_i *2
-:1: warning: `*' interpreted as argument prefix

--
Eric Hodel - drbrain@segment7.net - http://blog.se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...