TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
C# Coding Standard

Rule:  6@109Checked automatically with code checker

Synopsis:Don't return a function at an unexpected location
Severity Level:9
Category:Control flow


Minimize the number of returns in each routine. It's harder to understand a routine if, reading it at the bottom, you're unaware of the possibility that it returned somewhere above.

Use a return when it enhances readability. In certain routines, once you know the answer, you want to return it to the calling routine immediately. If the routine is defined in such a way that it doesn't require any cleanup, not returning immediately means that you have to write more code.

Literature References: