WD101 Ruby Project - Can't find error in Simon Say's Capitalize exercise?


Hi, I am currently doing the Web Dev 101 Ruby project and I am getting an Failure/Error but the expected output and the output that I get is exactly the same. So I don’t know how to make the tests pass?

Here is my code:

def titleize string
string = string.split(" “)
string[0] = string[0].capitalize
string.each do |str|
if(str.length > 4)
return string.join(” ")

I am capitalizing the first word from string array and then capitalizing every word from string array with more than four words and returning the joined string array.

I am also joining a screenshot of the error Here

Edit: Sorry I think the last word kwai is not getting capitalized so i think that’s the error. I will fix that.