[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Ruby arithmetic question.

darren kirby

6/16/2007 3:15:00 PM

quoth the Salai Khine:
> Dear all,
>
> I am very new to ruby language. I have some question in Ruby arthmetic
> operation.
>
> Why did i get 2 ** 2 = 4 ??

Because '**' is the exponentiation operator.

> a = 2 ** 2
>
> puts a
>
> --> 4
> Why ?
>
> It is like 2 ^ 2 = 4 ???

Exactly...

> regards,
> salai.

-d
--
darren kirby :: Part of the problem since 1976 :: http://badco...
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972