The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Early exits in various guises are a powerful tool in making program flow clear and maintainable. They are very good tools for avoiding levels of nesting and thus the obfuscation of program flow and context that levels of nesting engender. A related style issue to consider is instead of:
use
especially where the true path is a trivial case, or can be made into a trivial (small number of lines of code) case such as an empty line to be skipped or an error condition. In other words, deal with the trivia and fluff first and early exit where possible to avoid levels of indentation. Perl is environmentally friendly - it saves trees In reply to Re: "return" to break out of a loop
by GrandFather
|
|