#19 Syntax Error, need some help


#1


19 Inheriting a Fortune


Hi everybody,

I'm really stuck in this exercise, I tried refresh / forced refresh and no luck.

Are there any mistake in my code or is codecademy broken?

Error message:

(ruby):14: syntax error, unexpected keyword_end, expecting $end

My code:

class Message
    @@messages_sent = 0
    
    def initialize(from, to)
        @from = from
        @to = to
        @@messages_sent += 1
    end
end

Email < Message
    def initialize(subject)
        @subject = subject
    end
end

my_message = Message.new("Me", "Dad")


#2

Is Email expected to be another class inheiting from Message?


#3

Yes, here's the instruction:
"Create a second class, Email, that inherits from Message. Give it its own initialize method that takes just one parameter, subject, and has one instance variable, @subject, set equal to subject."

Am I doing anything wrong?


#4

You're not creating the class.


#5

Got it, I missed the "class"! Thanks a lot :slight_smile:

class Email < Message