not all code paths return a value in the method Isnt
There is a problem with Isnt method. Please help me
not all code paths return a value in the method Isnt
There is a problem with Isnt method. Please help me
After the for loop, insert a new return statement to return a value if there is nothing to iterate through.
There are values for a
(e.g. a=2
) which will not hit your for loop, so no return statement will be hit in that case.
Also please post code instead of screenshots.
Since you have defined the method with a return type 'bool'. The compiler tries to check if a boolean value is actually returned from that method through all possible flows, without being bound by any conditions. Logically this method would work for all possible values, but you need to make the compiler understand that.
There's no need to put that extra check if(a<2), just scribble a 'return false' outside the for loop and you're good. That's probably a better way of coding.
'See the compiler helps you with your coding standard after all ;) '