I'm just starting out with Ruby and trying to write a method that returns "Title was written by author", where title and author are variables. I think I'm close, but I'm not sure what to add at this point.
class Book
def set_title_and_author=(title, author)
@title = title
@author = author
end
def set_title_and_author
"#{@title} was written by #{@author}"
end
end
Aucun commentaire:
Enregistrer un commentaire