I'm pretty sure I've never seen "do { ... } if ...;" or similar. That is so pointlessly obfuscated that it is something I would avoid (such as in a coding standard) even more than I would avoid bare blocks as loops (which I also find can always be replaced with better alternatives). So I still jump to "loop" when I see ";\ndo {\n" and I will continue to. I also still don't jump to "loop" when I see a lone open bracket (and nobody should since most of the time they'd be wrong anyway).
So a do loop is clearer than a bare block "loop". True, there is no guarantee against somebody writing something that clearly looks like a loop but is in fact an unclear and uselessly obfuscated non-loop. That isn't a concern when trying to decide how to make code easy to maintain. If you've got "do { ... } if ...;" in your code, then you've got worse problems to deal with first.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|