The Pocoo style guide advises to use break, continue and return statements to avoid deeply nested code. How would you do that?
The Pocoo style guide advises to use break , continue and return statements to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A simple example would be that instead of this:
you can do this
Note that the latter saves an indentation level. Obviously you can’t always do this, but in some cases it improves readability to handle “if X then stop right away” conditions at the beginning, instead of having to wrap a large stretch of code in an
ifblock.