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

MICHAEL P
MICHAEL P
5,191 Points

Need Help With Ruby: How To create class within a module

Hi,

I need help with a Ruby Code Challenge: Module. I know how to do the first part, but I don't know how to do the 2nd part. I am stuck! I am hoping that someone can help me with this? Your help would be greatly appreciated:

Create a module called LaserBots.

module LaserBots
end

The 2nd part of the challenge is what I don't know how to do:

Inside of the LaserBots module, create a class called Player.

Thank you

2 Answers

Michael Hulet
Michael Hulet
47,913 Points

You'd declare the class just like you would any other class, but you'd do it inside the definition of your module, like this:

module LaserBots
    class Player
    end
end
MICHAEL P
MICHAEL P
5,191 Points

Thank you. I had an issue with my syntax