I don't Understand the Uninitialized Constant Exception

What does this error message mean? This is in reference to the mastermind project.
NameError: uninitialized constant Code::PEGS
What is an uninitialized constant? Do I need to define an instance variable or method PEGS? I’ve tried searching around for this error but haven’t found anything explaining what it means or why it gets raised.

I believe you have to create a constant within your class. It should be a hash that links colors to their first letter.
If you need help understanding constants: http://rubylearning.com/satishtalim/ruby_constants.html
I hope that makes sense to you and help you. Let me know if it doesn’t.
PEGS = { red: “R”}

That makes sense. Thanks for the response. Looking through the code again it makes sense why the specs would ask for a constant value; it comes in handy for making new codes.

1 Like

Great! @mjohnson324, glad to hear you’ve got it working :slight_smile: