[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: (String * Fixnum) and (Fixnum * String

Sebastian Hungerecker

8/21/2007 7:53:00 AM

Dan wrote:
> Just a small quick question:
>
> String * Fixnum works:
> ...
> while Fixnum * String doesn't:

Think of it like this:
4*3 = 4+4+4 (4 added 3 times) = 12
3*4 = 3+3+3+3 (3 added 4 times) = 12
Those are equivalent because x added y times and y added x times always give
the same result (x and y being numbers).

"bla"*3="bla"+"bla"+"bla" ("bla" added 3 times)="blablabla"
But what would 3 * "bla" be? 3 added "bla" times? What does that mean?

HTH,
Sebastian
--
NP: In Flames - System
Jabber: sepp2k@jabber.org
ICQ: 205544826