What if your code doesnt satisfy any of the if or else conditions? What will you return from the method? So you need to have a default return statement- when nothing matches you need to return some default value.
You are probably better off creating an enum, like this:No messing around with unitialised states, and no breaking the method in the middle. Note you have a default value for the result, so you are regarded as losing if you enter featherDuster, or something else not recognised.
What the compiler was complaining about was that you have lots of if-elses, but there is still the possibility that you will have something which never fulfils any of the ifs, so you never return anything.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Can you have a return statement in an if/else loop?