the function that you call needs to be of type IEnumerator - this is done implicitly when you use yield in the function, but if you add in a return (or it is possible to get through the function without hitting a yield), it'll see it as a void function
if you want to tell the compiler to do it explicitly, you could do function myFirstFunction() : IEnumerator {
Edit - In the example you posted, the compiler can't be sure there will be a yield if the string is too short (0 chars) - so it's confused as to the return type
you could fix it by putting yield; at the end, or making the function IEnumerator