#these wall of text exercises are frustrating - \n issues?

6 messages · Page 1 of 1 (latest)

cerulean flower
#

I'm working on the House exercise on the Ruby track and my code works I'm pretty sure, but the test is failing. It doesn't help that the "expected" is formatted like a wall of text that is impossible to read. halp?

#
class House
  def self.recite
    i = 0
    last_line = "that lay in the house that Jack built."
    verb = ["ate", "killed","worried","tossed","milked","kissed","married","woke","kept","belonged"]
    animal = ["malt","rat","cat","dog","cow with the crumpled horn","maiden all fornlorn","man all tattered and torn","priest all shaven and shorn","rooster that crowed in the morn","farmer sowing his corn","the horse and the hound and the horn"]
    output = []
    loop do
      case
        when i >= 2
          j = i - 1
          output << "\nThis is the #{animal[j]}\n"
          j.times do
          output << "that #{verb[j-1]} the #{animal[j-1]}\n"
          j -= 1
          end
          j = 0
          output << "#{last_line}\n"
          i += 1
        when i == 1
          output << "\nThis is the #{animal[i-1]}\n#{last_line}\n"
          i += 1
        when i==0
          output << "This is the house that Jack built.\n"
          i += 1
      end 
      if i == 12
        break
      end
    end
    output.join
  end
end```
patent frost
#

What's the test output show? ( No images please)

cerulean flower
#

oh geez... nevermind. chatgpt with the compare ftw (typos)

#

😄 thanks

patent frost
#

Diff tools rock!