How to print out the zombie's name and graveyard
Can you concatenate this without adding a string?
z = zombie.find(3)
puts z.name
puts z.graveyard
Is this wrong? It is only outputing the last one, graveyard.
You should use
puts "#{z.name} #{z.graveyard}"
You might be wondering how this would get evaluated! You should look at Interpolation. The result of the expressions z.name
and z.graveyard
gets concatenated/inserted into the string. Any expression that goes into #{ }
gets evaluated and inserted into the string