18/20 Error in "Forge an object..."


#1

Hello,
this is my code

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

my_message = Message.new ("SPb", "Ossetia" )

But it's wrong, The program says


my_message = Message.new ("SPb", "Ossetia" )
^
(ruby):9: syntax error, unexpected ')', expecting $end


Can anyone help me with the error?
Thanks


#2

Whitespace after new is raising the syntax error.


#3

Thank you very much!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.