Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: at continue, last

by BrowserUk (Patriarch)
on Jun 06, 2014 at 17:24 UTC ( [id://1089078]=note: print w/replies, xml ) Need Help??


in reply to Re^2: at continue, last
in thread at continue, last

That'll break the program's logic; $loop may only be decremented within the conditional (otherwise, yes, I'd put it outside of it).

I that case, decrement it as the first thing in the conditional, then you're guaranteed it'll happen.

The point is that, as described, there is no reason to employed contorted logic to achieve the described requirement.

Perhaps in an attempt to simplify the original code you've omitted something that makes the contorted logic necessary, but as posted, it simply isn't needed.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: at continue, last
by Anonymous Monk on Jun 06, 2014 at 17:43 UTC
    I replied to another similar comment elsewhere; $loop is used in the conditional, so decrementing it before I use it means I have to increment it every time I use it.
      Forgot to log in; the above post is mine.
Re^4: at continue, last
by djerius (Beadle) on Jun 06, 2014 at 17:52 UTC
    The point of the posting was to examine different ways of solving the underlying problem, namely ensuring that there's a single path to cleanup code in a conditional, and the obscure means by which it could be achieved. Perhaps that would have been a better introduction.
      The point of the posting was to examine different ways of solving the underlying problem,

      Understood.

      Most times, (though not all), when I find myself coding a tortuous solution, if I can step back from it, or get someone else's eyes upon it, there is a better solution.

      But almost without exception, if you focus too close on the problematic code out of context, you lose the overview which allows for the clean solution.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1089078]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-03-29 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found