Ruby Ruby Objects and Classes Variables and Methods Methods

Andrew Ackerman
Andrew Ackerman
8,347 Points

My code won't return the full-name method.

I feel like I'm putting too much thought into this, but I'm sure I'm following the exact things I learnt in the video. but I keep getting the same problem. Any help would be greatly appreciated!

name.rb
class Name
  attr_accessor :first_name, :last_name

  def initialize(first_name, last_name)
    @first_name = first_name
    @last_name = last_name
  end

  def full_name
    @first_name + "" + @last_name
  end
end

name = Name.new("Andrew", "Ackerman")
puts name.full_name

1 Answer

Ben Reynolds
Ben Reynolds
35,169 Points

In the full_name function, you need to put a space between first name and last name.

Andrew Ackerman
Andrew Ackerman
8,347 Points

Oh my gosh. I've been staring at it for so long with no clue. Thanks for that!