Jumping Guidelines

All jumping statements break the normal flow of an application, so they make the code harder to understand. To avoid confusion, you should use them as little as possible.

Of these statements, the Return statement seems the least confusing. It exits a routine so that a programmer reading the code doesn’t need to look at that routine anymore.

Despite its relative simplicity, some developers never use Return. Instead, they write code that always exits a routine by executing the last line of code. The thought is that having a single exit point makes it easier to figure out where the routine is exiting.

The Exit and Continue statements are the next least confusing. Their general ideas aren’t too complicated, but a programmer reading ...

Get Start Here!™ Fundamentals of Microsoft® .NET Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.