Subject: Re: Simple question
	Date: Mon 05 Nov 12 10:52:15PM +0900

Quoting August Y. (lists / ruby-forum.com):

> this block
> def size
>     pi=Math::PI
>     area=pi*($radus^2)
>     volume = 4/3*pi*($radus^3)
>     return volume
>     return $radus
>     return area
>   end
> 
> Returns this error
> C:/Users/jyoung/objects.rb:20:in `*': true can't be coerced into Float 
> (TypeError)
>   from C:/Users/jyoung/objects.rb:20:in `size'
>   from C:/Users/jyoung/objects.rb:31:in `<class:Test>'
>   from C:/Users/jyoung/objects.rb:4:in `<main>'
> 
> pi is defigned and $radus is to.f so what am i missing

^ is the exclusive-or operator. It returns a boolean value. Which
cannot be multiplied by a float.

It looks like you want the power operator, which is **

     area=pi*($radus**2)
     volume=4/3*pi*($radus**3)

Carlo

-- 
  *         Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido / fluido.as             che bisogno ci sarebbe
  *               di parlare tanto di amore e di rettitudine? (Chuang-Tzu)