How to create a valid return statement in a method
posted 2 months ago
I have a method called CalculateSimpleInterest () that calculates the interest according to the season type. Its return type is double . How to make it work correctly. I have a code that is throwing compile time error saying you need a valid return statement.
You have a series of if-else-if checks but no unconditional else part. Either add plain else clause with a return at the end as a "everything else" or just add a return after the if-else-if statements to return a value when none of the conditions before it are met.
Practice only makes habit, only perfect practice makes perfect.
Practice mindfully by doing the right things and doing things right.— Junilu