18/20 help


here is my code:
class Message
@@messages_sent = 0
def initialize (from,to)
@from =from
@to = to
my_message = Message.new ("me","you")

it says

(ruby):8: syntax error, unexpected ',', expecting ')'
my_message = Message.new ("me","you")
(ruby):8: syntax error, unexpected ')', expecting $end


I believe you need a space inbetween ("me","you") i.e. ("me", "you")


my_message=Message.new("me", "you")

Without space in object. Only in paramters in this case. :wink:


the ruby gods forbid space between the calling of a class and its parameters ...

object = class.new(parameter,parameter)

let it be known! lol hope this helps u remember better thats what helps me :sunglasses:


my_message = Message.new(@from, @to) or
my_message = Message.new("from", "to")


if your still having problem, just reset the code and retype the code and also you need to put @@message _sent just above the def....


This code gives me the green - light

class Message; @@messages_sent = 0; def initialize(from, to); @@messages_sent += 1
@from = from; @to = to; end; end; my_message = Message.new("james", "john") :christmas_tree:


Just in case anyone was having issues with this (even though I know this thread is hella old)…

What also worked for me was calling all three parameters (even though it only asked for the “from” and “to” parameter…


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

my_message = Message.new(“me”,“you”,“they”)

Hope maybe someone could use this :slight_smile:


thanks, this helped me a lot