>
>I don't wish to get into a long drawn out argument here either;)
>"From a coding standpoint, a method or function should have a single entry point" - agreed,
>"a single exit point" - highly debatable
>" perform a single function and return a single result. " OK but returning a single result doesn't mean you can't return multiple values. An object is a single variable but it can have virtually endless number of properties as 'values'.
>Cetin
I return structures or parameter objects from functions all the time. It is a single object but can have many properties and this still meets the definition of a single return value.
A single exit point: I agree that many use the intital test (which equals 2 exit points):
public bool myMethod()
{
if (someCondition)
{
return false;
}
...more code here
}
return true;
I don't code that way. I set a variable and then return the variable. What I meant is using a switch strucutre where you have exit points based on the case being examined, situations where you can have many exit points.