I got the following code in my program:
#region Handle
if(HandleLink(input))
goto Handled;
else if(HandlePath(input))
goto Handled;
else if(HandleGeneratedLink(input))
goto Handled;
else ...
else
return; // Break if not handled
#endregion
Handled:
Im not very happy with this, because to me it seems like a cheat to use a goto in every second line. Is there a common way to write such a thing or is this a valid solution?
You can also do something like this:
if (!HandleLink(input) && !HandlePath(input) && !HandleGeneratedLink(input)) {
return;
}
// put the code related to "Handled" here