0
This won’t work on SoloLearn 😢
Why does this not work on Sololearn but it works in Repl (and in irb)? def check(x) if x == "Grr" return "Lion " elsif x == "Rawr" return "Tiger " elsif x == "Chirp" return "Bird " else return "Snake " end end animals = gets.chomp.split(" ") for i in 0..(animals.count)-1 print check(animals[i]) end
3 Réponses
+ 1
Sololearns codeplayground is not propperly devoleped yet
Or sl uses dif version of ruby
0
I’ve got it working now...I removed all the indents 👍🏻
def check(x)
if x == "Grr"
return "Lion "
elsif x == "Rawr"
return "Tiger "
elsif x == "Chirp"
return "Bird "
else
return "Snake "
end
end
animals = gets.chomp.split(" ")
for i in 0..(animals.count)-1
print check(animals[i])
end