Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Modules Ruby Core Modules Math

Using the sqrt method in the Math module, assign the value of the square root of 9 to the variable @sqrt.

I have found others that have had trouble with this challenge. I'm wondering if anyone has completed it. I have tried everything but nothing is working.

math.rb
@pi = nil
@e  = nil
@sqrt = nil

module Math

  Math::E = @e
  Math::PI = @pi
  @sqrt = Math.sqrt(9)

end

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Take the sqrt line and put it after the end. It doesn't want it inside of the module. Hope this helps!

Nickolas Fuentes
Nickolas Fuentes
14,016 Points

Thanks I was wondering why it wasn't working. Even in the question it says in the math module, which is strange.

@pi = nil @e = nil @sqrt = nil

module Math Math::E = @e Math::PI = @pi Math.sqrt(9) = @sqrt end

why is this wrong?

please advice...

thank you in advance <3

This worked for me, hope this helps someone :)

@pi = nil @e = nil @sqrt = nil

module Math

Math::E = @e Math::PI = @pi end

@sqrt = Math.sqrt(9)