In IRB, or saved as a program from Scite, put in something like:

puts(MATH::PI)

response is always " Uninitialized constant MATH(NameError)

How can I tell if I have the MATH module in my installation? If I don't

have it, how do I fix that? Thanks in advance.

## ···

--

Posted via http://www.ruby-forum.com/.

Capitalisation issue?

> irb

ruby-1.9.2-p0 > puts Math::PI

3.141592653589793

=> nil

ruby-1.9.2-p0 > puts MATH::PI

NameError: uninitialized constant Object::MATH

from (irb):2

from /usr/home/sduncan/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'

ruby-1.9.2-p0 > defined?(Math)

=> "constant"

ruby-1.9.2-p0 > defined?(MATH)

=> nil

Sam

## ···

On 24/11/10 08:09, Charles Agriesti wrote:

In IRB, or saved as a program from Scite, put in something like:

puts(MATH::PI)

response is always " Uninitialized constant MATH(NameError)

How can I tell if I have the MATH module in my installation? If I don't

have it, how do I fix that? Thanks in advance.

You could do something like this.

Object.constants.grep(/math/i) # => [:Math]

## ···

On Tue, Nov 23, 2010 at 1:09 PM, Charles Agriesti <dragriesti@comcast.net>wrote:

In IRB, or saved as a program from Scite, put in something like:

puts(MATH::PI)

response is always " Uninitialized constant MATH(NameError)

How can I tell if I have the MATH module in my installation? If I don't

have it, how do I fix that? Thanks in advance.

--

Posted via http://www.ruby-forum.com/\.

Sam Duncan wrote in post #963414:

Capitalisation issue?

...

Sam

Doh! Thanks. Can't believe I did that.

## ···

--

Posted via http://www.ruby-forum.com/\.