Consider the following program.
function isEven(n)
if n % 2 == 0
return true
If this function was invoked with an odd number, null is returned. However, the invoker may be expecting a boolean result. Therefore, the programmer must be reminded to return a value from a function for all cases if at least one return statement appears.
Consider the following program.
If this function was invoked with an odd number, null is returned. However, the invoker may be expecting a boolean result. Therefore, the programmer must be reminded to return a value from a function for all cases if at least one return statement appears.