#these wall of text exercises are frustrating - \n issues?
6 messages · Page 1 of 1 (latest)
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```
What's the test output show? ( No images please)
Diff tools rock!