Page 1 of 5 1234 ... LastLast
Results 1 to 10 of 45

Thread: FrankCheng.com updated

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Posts
    963

    Default FrankCheng.com updated

    Hi all,

    It's time for my shameless plug - new entry added on http://www.frankcheng.com
    This time it's about "loops". I will add an entry soon regarding tooltip on disabled button.
    Stayed tuned.

    Frank Cheng

  2. #2
    Join Date
    Feb 2009
    Location
    Castlegar, BC Canada
    Posts
    4,051

    Default Re: FrankCheng.com updated

    Thanks Frank

  3. #3
    Join Date
    Feb 2009
    Posts
    2,012

    Default Re: FrankCheng.com updated

    Thanks Frank, appreciate your work. I actually learnt something from that. I'm pretty sure I always use For/Loop but I can see For/Until would be useful as well but can't remember thinking to use it before.
    Cheers

  4. #4
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    10,065

    Default Re: FrankCheng.com updated

    Quote Originally Posted by Richard Hogg View Post
    Thanks Frank, appreciate your work. I actually learnt something from that. I'm pretty sure I always use For/Loop but I can see For/Until would be useful as well but can't remember thinking to use it before.
    Cheers
    So - For/Until would mean you could check another condition (besides the count) & exit? Hmmm.... Could the While/Until also use 2 conditions?

    While (Found)
    ....
    Until (bGarretGrowsUp)

    OK - I know the 2nd condition will never happen...
    Garret

    I ordered a chicken and an egg from Amazon.

    I'll let you know...

  5. #5
    Join Date
    Feb 2009
    Location
    SW Connecticut/NY area
    Posts
    8,375

    Default Re: FrankCheng.com updated

    OK - I know the 2nd condition will never happen...
    Endless loop
    Bob Worsley
    203-249-2633
    rlworsley at gmail.com

    Do or do not. There is no try. — Yoda

  6. #6
    Join Date
    Feb 2009
    Location
    Castlegar, BC Canada
    Posts
    4,051

    Default Re: FrankCheng.com updated


  7. #7

    Default Re: FrankCheng.com updated

    It is a tad weird, but I am warming to the idea of using the For/Until loop, it seems practical and pretty clean.
    The alternative would be a break, which is fine until you put it in a begin/end pair.
    Something that might happen during a refactor, at least the until isn't sensitive for that kind of breakage.
    --
    Wil

  8. #8
    Join Date
    Feb 2009
    Location
    Sweden
    Posts
    1,739

    Default Re: FrankCheng.com updated

    I think the best solution, given that Break does not work, would be a BreakLoop command. This would be made to break just For, While and Repeat, and not Begin. A ContinueLoop command could also be added. That way we could use BreakLoop and ContinueLoop just like break and continue in C.

    Personally, I always implement Break in For loops like below. Feel wrong to mess with the loop counter, though:

    Code:
    For iIndex from 0 to iEnd
        [...]
        If (bBreak) Begin
            Move iEnd to iIndex // Break loop.
        End
    Loop
    // Anders

  9. #9

    Default Re: FrankCheng.com updated

    Hello Anders,

    Quote Originally Posted by Anders Ohrt View Post
    I think the best solution, given that Break does not work, would be a BreakLoop command. This would be made to break just For, While and Repeat, and not Begin. A ContinueLoop command could also be added. That way we could use BreakLoop and ContinueLoop just like break and continue in C.

    Personally, I always implement Break in For loops like below. Feel wrong to mess with the loop counter, though:

    Code:
    For iIndex from 0 to iEnd
        [...]
        If (bBreak) Begin
            Move iEnd to iIndex // Break loop.
        End
    Loop
    I do the same and I always feel dirty for doing that and yes it means having to comment the reason why you are messing with the iterator variable.

    IMO, DAW fixing the break command, so that it works as expected, would even be better then a new breakloop command.

    Are there even people who use the break command to break out of a begin/end scope? Is that a thing?
    --
    Wil

  10. #10
    Join Date
    Feb 2009
    Location
    Sweden
    Posts
    1,739

    Default Re: FrankCheng.com updated

    Hi Wil,

    Quote Originally Posted by wila View Post
    IMO, DAW fixing the break command, so that it works as expected, would even be better then a new breakloop command.
    Fixing Break would break (pun intended) backwards compatibility. If that is acceptable, it is the best solution IMO as well. My suggestion was only if the current Break behavior needed to be preserved.


    Quote Originally Posted by wila View Post
    Are there even people who use the break command to break out of a begin/end scope? Is that a thing?
    I cannot see any reason to do so. But I've seen plenty of weird code doing unreasonable things, so maybe... =)
    // Anders

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •