18/20 Forge an object


#1

I passed this exercise but it is not producing any output except for a #. How can I get the output to put out the two arguements that are passed to initialize?

Here is my code:

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

my_message = Message.new("Aus", "Eur")

I've tried puts but that doesn't work
Thank you in advance

`


#2

One thing you need to do is put from and to (not @from and @to) as parameters in init.


#3

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

my_message = Message.new("Aus", "Eur")

Output is still #, how can I have the output "Aus" and "Eur"?


#4

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