I have been reading that a value needs to be returned by a function, otherwise the following error will occur:
"Function <function name> doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used."
The cure, I have found, is to return something (i.e. "Return 0") before exiting the function. Can someone please enlighten me as to why this might be useful? Can I pass this return value back to the routine that called the function? If so, how do I code this?
Most of the time, however, I find I'm not needing to return a value anyway, and just end up adding "0" to the ends of all my Return statements. Does anyone have any comments on this?
Links referred to:
View Complete Post