Ron Savage

  • Website:
  • About: I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...
Subscribe to feed Recent Actions from Ron Savage

  • Mithaldu commented on Else Clauses on Loops

    Haha, alright Ron, thanks for the information, neat to know. Really breaks my comparison. :)

    Grinnz: Could you maybe post a direct link to a guide on how to write something with the syntax plugins?

  • morandimus commented on Else Clauses on Loops

    Mithaldu, while you are technically correct (the best kind of correct!) I personally find the foreach spelling of for to be a lot more intuitive because it's more like natural language. And to me, fewer characters is never more important than better clarity.

  • morandimus commented on Else Clauses on Loops

    Pawel, in your for loop example, the else clause would not be executed because the loop was executed at least once (it had to be entered in order to get to the last). In your while example, the else clause would be executed, because the loop body was never entered. I hope that is clear from my description.

    Any language feature can be abused and sure, you could use this to create confusing and nonintuitive code. You can also write whole scripts that executed in the evaluation part of s///e, but that doesn't m…

  • morandimus commented on Else Clauses on Loops

    preaction, while googling around to see if any other languages have this feature, I encountered the else clause on loops in Python. I was really boggled... it seems like it's invoked in the exact opposite of circumstances when a loop's "else" clause should be.

    I agree this would be very useful when paired with grep (or map)

  • morandimus commented on Else Clauses on Loops

    Grinnz, I think the functionality of the continue block would be unaffected. It is executed after each iteration of the loop body, so if the loop block is executed at least once, the continue block is executed at least once (and the else block is skipped), and if the loop body is never executed, the continue block is never executed (and the else block is executed).

    That said, are both of the following allowed? Is there a difference in execution between them? Is the second nonsensical and should be disallowed?

      while …

Subscribe to feed Responses to Comments from Ron Savage

About is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.