Professional Web Applications Themes

Elegant solution for a loop-break problem - Ruby

>>>>> "K" == KONTRA Gergely <kgergelymlabdial.hit.bme.hu> writes: K> Can I exit more loops with next/last/redo? (like in perl) You have catch, throw K> Is there something similar to python's for .. else ... structure? (Do K> something, ONLY when the loop is terminated normally (without break) You can write something like this svg% cat b.rb #!/usr/bin/ruby for j in 1..2 puts '==================' if for i in 1..2 p i break if j == 1 end p "ok" end end svg% svg% b.rb ================== 1 ================== 1 2 "ok" svg% Guy Decoux...

  1. #1

    Default Re: Elegant solution for a loop-break problem

    >>>>> "K" == KONTRA Gergely <kgergelymlabdial.hit.bme.hu> writes:

    K> Can I exit more loops with next/last/redo? (like in perl)

    You have catch, throw

    K> Is there something similar to python's for .. else ... structure? (Do
    K> something, ONLY when the loop is terminated normally (without break)

    You can write something like this

    svg% cat b.rb
    #!/usr/bin/ruby
    for j in 1..2
    puts '=================='
    if for i in 1..2
    p i
    break if j == 1
    end
    p "ok"
    end
    end
    svg%

    svg% b.rb
    ==================
    1
    ==================
    1
    2
    "ok"
    svg%

    Guy Decoux

    ts Guest

  2. #2

    Default Re: Elegant solution for a loop-break problem

    raising an Exception is an excellent way of escaping nested loops.
    - mr

    On Thu, 7 Aug 2003 23:17:13 +0900, KONTRA Gergely
    <kgergelymlabdial.hit.bme.hu> wrote:
    > Hi!
    >
    > I've tried to write a little program, which detect duplicate files.
    > My way to solve this is to have a hash for the known files like this
    > { fileSize => [[file1,file2],[file3,file4]],
    > fileSize2 => [[file6,file7]] }
    >
    > So, file1..file4 have the same size, file1 and file2's content is
    > identical, similarly file3 and file4 is identical.
    >
    > First, the Hash is empty, and then I insert the files to be examined,
    > like this.
    >
    > files = Hash.new { [] }
    > for filename in filesToBeAdded
    > filesize=File.filesize(filename)
    > for fn in filename[filesize]
    > if equalContent(fn[0], filename)
    > # add this file to this 'segment' TODO: alter files
    > # next 'filename in filesToBeAdded'
    > end
    > end
    > # if loop exited normally, create a new segment
    > end
    >
    > So questions in general:
    > How can I alter items in a hash nicely?
    > Can I exit more loops with next/last/redo? (like in perl)
    > Is there something similar to python's for .. else ... structure? (Do
    > something, ONLY when the loop is terminated normally (without break)
    >
    > thx
    > Gergo


    meinrad.recheis Guest

  3. #3

    Default Re: Elegant solution for a loop-break problem

    On Thu, Aug 07, 2003 at 11:17:13PM +0900, KONTRA Gergely wrote:
    > So questions in general:
    > How can I alter items in a hash nicely?
    h[key] = value # replace it
    h[key] << value # append to existing array
    > Can I exit more loops with next/last/redo? (like in perl)
    If you want to exit out of more than one level, use catch/throw.
    [you mean next/break/redo I think]
    > Is there something similar to python's for .. else ... structure? (Do
    > something, ONLY when the loop is terminated normally (without break)
    Hmm, I don't understand - why not just put the code at the end of the block?
    If you haven't done a 'break' or 'next' then it will be executed.

    You might be able to use begin ... ensure ... end; the ensure section is
    *always* executed.

    irb(main):008:0> 5.times { begin puts "x"; break; ensure puts "y"; end }
    x
    y
    => nil


    Regards,

    Brian.

    Brian Candler Guest

  4. #4

    Default Re: Elegant solution for a loop-break problem

    On 0807, Brian Candler wrote:
    > On Thu, Aug 07, 2003 at 11:17:13PM +0900, KONTRA Gergely wrote:
    > > So questions in general:
    > > How can I alter items in a hash nicely?
    >
    > h[key] = value # replace it
    > h[key] << value # append to existing array
    Oops. Sorry. The question was dumb. I mean: I want to iterate over a
    hash and change some elements. (in perl you get the elements, not copys
    of the elements.
    > > Can I exit more loops with next/last/redo? (like in perl)
    > If you want to exit out of more than one level, use catch/throw.
    > [you mean next/break/redo I think]
    Yes, this works, but is there any exception? Wouldn't it be confusing?
    > > Is there something similar to python's for .. else ... structure? (Do
    > > something, ONLY when the loop is terminated normally (without break)
    Eg. suppose I want to search for value in array
    If it would be a for .. else .. end construction in ruby, I could write:

    for element in array
    if element==value
    puts "#{element} found in array!"
    break
    end
    else
    puts "#{element} not found in array"
    end


    But ts showed, that a loop returns nil, if I use break without a
    parameter. (if I'm right...)

    Gergo
    --
    +-[ Kontra, Gergely<kgergelymcl.hu> PhD student Room IB113 ]---------+
    | [url]http://www.mcl.hu/~kgergely[/url] "Olyan langesz vagyok, hogy |
    | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" |
    +-- Magyar php mirror es magyar php dokumentacio: [url]http://hu.php.net[/url] --+

    KONTRA Gergely Guest

  5. #5

    Default Re: Elegant solution for a loop-break problem

    >>>>> "K" == KONTRA Gergely <kgergelymlabdial.hit.bme.hu> writes:

    K> But ts showed, that a loop returns nil, if I use break without a
    K> parameter. (if I'm right...)

    break with a parameter work only with 1.8 (1.6 give an syntax error)

    Guy Decoux



    ts Guest

  6. #6

    Default Re: Elegant solution for a loop-break problem


    "KONTRA Gergely" <kgergelymlabdial.hit.bme.hu> schrieb im Newsbeitrag
    news:20030807141710.GE7040mlabdial.hit.bme.hu...
    > Hi!
    >
    > I've tried to write a little program, which detect duplicate files.
    > My way to solve this is to have a hash for the known files like this
    > { fileSize => [[file1,file2],[file3,file4]],
    > fileSize2 => [[file6,file7]] }
    >
    > So, file1..file4 have the same size, file1 and file2's content is
    > identical, similarly file3 and file4 is identical.
    >
    > First, the Hash is empty, and then I insert the files to be examined,
    > like this.
    >
    > files = Hash.new { [] }
    > for filename in filesToBeAdded
    > filesize=File.filesize(filename)
    > for fn in filename[filesize]
    > if equalContent(fn[0], filename)
    > # add this file to this 'segment' TODO: alter files
    > # next 'filename in filesToBeAdded'
    > end
    > end
    > # if loop exited normally, create a new segment
    > end
    Often the best solution is to use modularization for such problems. It
    makes code more readable and easier to maintain:

    def addToGroup(group, filename)
    for fn in group
    if equalContent(fn[0], filename)
    # add this file to this 'segment' TODO: alter files
    # next 'filename in filesToBeAdded'
    fn << filename
    return
    end
    end
    # if loop exited normally, create a new segment
    group << [filename]
    end

    # or, a bit more rubish

    def addToGroup(group, filename)
    group.each do |fn|
    if equalContent(fn[0], filename)
    # add this file to this 'segment' TODO: alter files
    # next 'filename in filesToBeAdded'
    fn << filename
    return
    end
    end
    # if loop exited normally, create a new segment
    group << [filename]
    end

    # main
    files = Hash.new { [] }
    for filename in filesToBeAdded
    filesize=File.filesize(filename)
    addToGroup( files[ filesize ] )
    end
    > So questions in general:
    > How can I alter items in a hash nicely?
    hash[ key ].<any_method_you_like>
    > Can I exit more loops with next/last/redo? (like in perl)
    As others pointed out not in all versions of ruby.
    > Is there something similar to python's for .. else ... structure? (Do
    > something, ONLY when the loop is terminated normally (without break)
    Dunno.

    robert

    Robert Klemme Guest

  7. #7

    Default Re: Elegant solution for a loop-break problem

    * meinrad.recheis <my.name.heregmx.at> [Aug, 07 2003 16:50]:
    > raising an Exception is an excellent way of escaping nested loops.
    >
    throwing and catching is an excellent way of escaping nested loops,
    raising exceptions is not.
    nikolai


    --
    ::: name: Nikolai Weibull :: aliases: pcp / lone-star :::
    ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
    ::: page: [url]www.pcppopper.org[/url] :: fun atm: gf,lps,ruby,php,war3 :::
    main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

    Nikolai Weibull Guest

  8. #8

    Default Re: Elegant solution for a loop-break problem

    On Fri, Aug 08, 2003 at 12:00:15AM +0900, KONTRA Gergely wrote:
    > > > How can I alter items in a hash nicely?
    > >
    > > h[key] = value # replace it
    > > h[key] << value # append to existing array
    >
    > Oops. Sorry. The question was dumb. I mean: I want to iterate over a
    > hash and change some elements. (in perl you get the elements, not copys
    > of the elements.
    In Ruby you get the elements, not copies of the elements.

    If you want to replace elements with completely new objects, you could do

    h.each_key do |k|
    h[k] = new_element
    end

    But otherwise you call whatever mutator method you like on the object which
    is in the hash:

    h.each do |e|
    e.change_my_state
    end
    > > > Can I exit more loops with next/last/redo? (like in perl)
    > > If you want to exit out of more than one level, use catch/throw.
    > > [you mean next/break/redo I think]
    > Yes, this works, but is there any exception? Wouldn't it be confusing?
    I think it's pretty clear:

    catch(:foo) do
    8.times do |x|
    8.times do |y|
    puts "#{x},#{y}"
    throw :foo if x*y == 18
    end
    end
    end

    But actually it's more powerful than that. You can throw exceptions from
    within nested method calls. For example, you can have

    # program main event loop
    loop do
    catch :end_request do
    handle_request
    end
    end

    Then handle_request can call methods, which call other methods, and
    somewhere deep down you can decide to send a message to the user (say a page
    of HTML) then "throw :end_request". This brings you right back to the main
    loop. It's like "return" but for multiple levels of method call.
    > > > Is there something similar to python's for .. else ... structure? (Do
    > > > something, ONLY when the loop is terminated normally (without break)
    >
    > Eg. suppose I want to search for value in array
    > If it would be a for .. else .. end construction in ruby, I could write:
    >
    > for element in array
    > if element==value
    > puts "#{element} found in array!"
    > break
    > end
    > else
    > puts "#{element} not found in array"
    > end
    >
    > But ts showed, that a loop returns nil, if I use break without a
    > parameter. (if I'm right...)
    Oh I see what you want now - something which is executed after the last
    iteration of the loop, if it was successful.

    Regards,

    Brian.

    Brian Candler Guest

  9. #9

    Default Re: Elegant solution for a loop-break problem

    On Fri, 8 Aug 2003 00:00:15 +0900
    KONTRA Gergely <kgergelymlabdial.hit.bme.hu> wrote:
    > > > Is there something similar to python's for .. else ... structure? (Do
    > > > something, ONLY when the loop is terminated normally (without break)
    >
    > Eg. suppose I want to search for value in array
    > If it would be a for .. else .. end construction in ruby, I could write:
    >
    > for element in array
    > if element==value
    > puts "#{element} found in array!"
    > break
    > end
    > else
    > puts "#{element} not found in array"
    > end
    If I were you, I'd just use the #include? method to see if an array
    contains an element. Or, I might search for an element in the array like so:
    > >> array = [1,2,4,9]
    => [1, 2, 4, 9]
    >> array.detect { |e| e % 2 == 0 }
    => 2
    >> array.detect { |e| e == 10 }
    => nil
    >> array.detect { |e| e/2 > 2 }
    => 9

    ....and so on. Except you're talking about break, so this is all beside
    the point.

    Jason Creighton
    Jason Creighton Guest

  10. #10

    Default Re: Elegant solution for a loop-break problem

    Scripsit ille »Brian Candler« <B.Candlerpobox.com>:
    > On Fri, Aug 08, 2003 at 12:00:15AM +0900, KONTRA Gergely wrote:
    > > > > How can I alter items in a hash nicely?
    > > >
    > > > h[key] = value # replace it
    > > > h[key] << value # append to existing array
    > >
    > > Oops. Sorry. The question was dumb. I mean: I want to iterate over a
    > > hash and change some elements. (in perl you get the elements, not copys
    > > of the elements.
    >
    > In Ruby you get the elements, not copies of the elements.
    >
    > If you want to replace elements with completely new objects, you could do
    >
    > h.each_key do |k|
    > h[k] = new_element
    > end
    >
    > But otherwise you call whatever mutator method you like on the object which
    > is in the hash:
    >
    > h.each do |e|
    > e.change_my_state
    > end
    he means, that in Perl you can do:

    use Data::Dumper;
    l = qw(one two three);
    for my $elem(l)
    {
    $elem = 'X' . uc $elem;
    }
    print Dumper \l;

    which yields

    $VAR1 = [
    'XONE',
    'XTWO',
    'XTHREE'
    ];

    while something which looks like its equivalent in Ruby:

    l = %w{one two three}
    l.each() do |elem|
    elem = 'X' + elem.upcase()
    end
    p l

    does not work like a Perl programmer expects:

    ["one", "two", "three"]

    Of course, elem.upcase!() would solve the problem... but in this case,
    eventually the equivalent of Perl's map operator, Array#collect and
    Array#collect!, are more appropiate:

    l = %w{one two three}
    l.collect!() do |elem|
    'X' + elem.upcase()
    end
    p l

    which works. BTW, one can use "next" instead of return to yield a
    return value:

    l = %w{one two three}
    l.collect!() do |elem|
    next elem if elem.match(/wo/)
    next 'four' if elem == 'three'
    'X' + elem.upcase()
    end
    p l

    But, as stated in the other posting, that's a 1.8 feature. Contrary to
    next, break works the usual way.

    def tester(&block)
    5.times() do |x|
    p :before => x
    y = yield x
    p :after => y
    end
    p :end
    42
    end
    p (tester do |x|
    next 'CAUGHT' if x == 1
    break 'BROKEN' if x == 3
    x
    end)

    So the next doesn't exit a loop iteration (the second :after wouldn't
    have been printed then) but returns a value from a block. Looks like
    an intended feature. The break, however, exits the block-using method
    'tester'. Somehow looks suspicious to me. But it's a yield feature
    and can be cirvented by calling he block directly; the break can
    be "caught":

    3.times() do |t|
    p t
    begin
    break 17
    ensure next
    end
    end

    prints 0, 1 and 2. The break value however is lost. I think it would be
    a good idiom if one puts "ensure next" in the same line... since this
    construct is to ensure that there'll be every loop iteration and breaks
    will be ignored (transformed into nexts, that is). But, somehow I don't
    like it:

    3.times() do |t|
    p t
    begin
    raise "StupidError"
    ensure next
    end
    end

    Even the exception is silently ignored.

    3.times() do |t|
    p t
    begin
    throw :ball
    ensure next
    end
    end

    "works" the same way. Somehow "ensure" seems to be too strong for me...
    can one check WHY one is in an ensure block, that is, because of a return,
    a break, a next, an exception or in the normal program flow?

    As this program shows, there seems to be only one way to get out; to make
    it less obvious, I used random order of breaking-out attempts:

    def unbreakable(&block)
    loop do
    begin
    yield
    ensure next
    end
    end
    end

    def thefooledone()
    cont = callcc() do |c| c end
    if cont
    catch :ball do
    unbreakable do
    i = rand(6)
    p :this_time => i
    case i
    when 0 then return 42
    when 1 then break
    when 2 then cont.call()
    when 3 then next
    when 4 then raise "ID10T"
    when 5 then throw :ball
    end
    end
    end
    end
    end

    thefooledone()
    Rudolf Polzer Guest

  11. #11

    Default Re: Elegant solution for a loop-break problem

    why not? (i dont understand your indignation) because something is intended
    for something special, it does not mean that it isnt good for something
    else.
    however, in java it is the only way to escape a nested loop.

    -mr

    On Thu, 7 Aug 2003 16:54:48 +0200, Robert Klemme <bob.newsgmx.net> wrote:
    >
    > "meinrad.recheis" <my.name.heregmx.at> schrieb im Newsbeitrag
    > news:oprtjhkqv9edtuaznews.tuwien.ac.at...
    >> raising an Exception is an excellent way of escaping nested loops.
    >
    > Err, are you serious? IMHO exceptions are for exceptional conditions and
    > not for control flow.
    >
    > robert
    >
    >

    meinrad.recheis Guest

  12. #12

    Default Re: Elegant solution for a loop-break problem

    Scripsit ille »Brian Candler« <B.Candlerpobox.com>:
    > In Ruby:
    >
    > l = %w{one two three}
    > l.each do |elem|
    > elem.replace('X' + elem.upcase)
    > end
    > p l
    >
    > In other words, you have to mutate the existing element; assigning to 'elem'
    > does not replace the element, it simply makes the local variable point
    > elsewhere.
    Yes, that is exactly the problem.
    > There is some Bad Magic going on in the Perl version; somehow $elem is
    > aliasing an element of the array, it is not a normal variable at all.
    Yes, and that's why I think many languages, including Ruby and Java,
    need "pointers". The typical Java workaround is a size-1 array. You can
    do the same in Ruby of course... but I wouldn't like it.

    Perl, for example, has pointers:

    my $x = 17;
    my $ptr = \$x; # <-- THAT's the thing which is missing in Ruby!
    ${$ptr} = 42;

    An alternative would then look like this - they aren't really pointers,
    they're one-element containers which can be used similar to other
    pointer workaround:

    class Pointer
    def initialize(v)
    pointer_target = v
    end
    def []()
    pointer_target
    end
    def []=(other)
    pointer_target = other
    end
    end

    class PointerArray < Array
    def [](a)
    return super(a)[]
    end
    def []=(a, b)
    return super(a, Pointer.new(b))
    end
    end

    a = PointerArray.new()
    a[0] = "Hello"
    a[1] = "World"
    a.each() do |x|
    x[] = "*** " + x[] + " ***"
    end
    p a[0]
    p a[1]

    # evil - but Ruby handles it nicely:
    x = Pointer.new(42)
    x[] = x
    p x
    Rudolf Polzer Guest

  13. #13

    Default Re: Elegant solution for a loop-break problem

    In article <20030807185529.A48669linnet.org>,
    Brian Candler <B.Candlerpobox.com> wrote:
    >On Fri, Aug 08, 2003 at 01:46:20AM +0900, Rudolf Polzer wrote:
    >> he means, that in Perl you can do:
    >>
    >> use Data::Dumper;
    >> l = qw(one two three);
    >> for my $elem(l)
    >> {
    >> $elem = 'X' . uc $elem;
    >> }
    >> print Dumper \l;
    >>
    >> which yields
    >>
    >> $VAR1 = [
    >> 'XONE',
    >> 'XTWO',
    >> 'XTHREE'
    >> ];
    [...]
    >There is some Bad Magic going on in the Perl version; somehow $elem is
    >aliasing an element of the array, it is not a normal variable at all.
    That's not "bad magic," it's a feature - see the discussion of foreach
    in the perlsyn manual page:

    If any element of LIST is an lvalue, you can modify it by modifying VAR
    inside the loop. Conversely, if any element of LIST is NOT an lvalue,
    any attempt to modify that element will fail. In other words, the
    "foreach" loop index variable is an implicit alias for each item in the
    list that you're looping over.

    Mike
    --
    [email]mikestok.co.uk[/email] | The "`Stok' disclaimers" apply.
    [url]http://www.stok.co.uk/~mike/[/url] | GPG PGP Key 1024D/059913DA
    [email]mikeexegenix.com[/email] | Fingerprint 0570 71CD 6790 7C28 3D60
    [url]http://www.exegenix.com/[/url] | 75D2 9EC4 C1C0 0599 13DA
    Mike Stok Guest

  14. #14

    Default Re: Elegant solution for a loop-break problem

    meinrad.recheis wrote:
    > why not? (i dont understand your indignation) because something is
    > intended for something special, it does not mean that it isnt good for
    > something else.
    > however, in java it is the only way to escape a nested loop.
    >
    > -mr

    Actually, in Java you can do this (or at least, you could in the past):

    void foo()
    {
    for(int i = 0;i < 100;i++)
    {
    for(int j = 100;j > 0;j--)
    {
    if(i == j) break bar;
    }
    }
    bar:
    }

    As long as you don't mind using labels.


    Dan Doel Guest

  15. #15

    Default Re: Elegant solution for a loop-break problem

    Ok, i see. you could end up rescueing exceptions that should not be cought,
    for they were not raised to escape the loops.
    sorry, mr

    On Fri, 8 Aug 2003 04:29:48 +0900, Hal E. Fulton <hal9000hypermetrics.com>
    wrote:
    > ----- Original Message -----
    > From: "meinrad.recheis" <my.name.heregmx.at>
    > Newsgroups: comp.lang.ruby
    > To: "ruby-talk ML" <ruby-talkruby-lang.org>
    > Sent: Thursday, August 07, 2003 1:46 PM
    > Subject: Re: Elegant solution for a loop-break problem
    >
    >
    >> why not? (i dont understand your indignation) because something is
    > intended
    >> for something special, it does not mean that it isnt good for something
    >> else.
    >> however, in java it is the only way to escape a nested loop.
    >
    > I don't think he's indignant. Nor am I. But I think
    > exceptions are not the best way to do this in Ruby.
    >
    > I think in Ruby you should use throw/catch instead
    > of raising an exception... I perceive these to be
    > for exactly such boundary situations.
    >
    > Hal
    >
    >> -mr
    >>
    >> On Thu, 7 Aug 2003 16:54:48 +0200, Robert Klemme <bob.newsgmx.net>
    >> wrote:
    >>
    >> >
    >> > "meinrad.recheis" <my.name.heregmx.at> schrieb im Newsbeitrag
    >> > news:oprtjhkqv9edtuaznews.tuwien.ac.at...
    >> >> raising an Exception is an excellent way of escaping nested loops.
    >> >
    >> > Err, are you serious? IMHO exceptions are for exceptional conditions
    > and
    >> > not for control flow.
    >> >
    >> > robert
    >> >
    >> >
    >>
    >>
    >>
    >
    >
    >


    --
    - mr
    meinrad.recheis Guest

  16. #16

    Default Re: Elegant solution for a loop-break problem

    On Fri, Aug 08, 2003 at 03:46:43AM +0900, meinrad.recheis wrote:
    > why not? (i dont understand your indignation) because something is intended
    > for something special, it does not mean that it isnt good for something
    > else.
    > however, in java it is the only way to escape a nested loop.
    I hope, we never program in java together.

    --
    marko schulz

    Marko Schulz Guest

  17. #17

    Default References in Ruby (Was: Elegant solution for a loop-break problem)

    On Thu, 2003-08-07 at 15:26, Rudolf Polzer wrote:
    > Perl, for example, has pointers:
    >
    > my $x = 17;
    > my $ptr = \$x; # <-- THAT's the thing which is missing in Ruby!
    > ${$ptr} = 42;
    Actually, you can get pretty close ...

    x = 17
    ref = Ref.new{:x}
    p x # => 17
    p ref.value # => 17

    x = 10
    p x # => 10
    p ref.value # => 10

    ref.value = 42
    p x # => 42
    p ref.value # => 42

    I'll post the source for Ref is another posting for those that wish to
    puzzle over it before seeing the solution.

    --
    -- Jim Weirich [email]jweirichone.net[/email] [url]http://onestepback.org[/url]
    -----------------------------------------------------------------
    "Beware of bugs in the above code; I have only proved it correct,
    not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

    Jim Weirich Guest

  18. #18

    Default Re: Elegant solution for a loop-break problem

    On Fri, 8 Aug 2003 00:00:15 +0900, KONTRA Gergely wrote:
    >>> Is there something similar to python's for .. else ... structure? (Do
    >>> something, ONLY when the loop is terminated normally (without break)
    > for element in array
    > if element==value
    > puts "#{element} found in array!"
    > break
    > end
    > else
    > puts "#{element} not found in array"
    > end
    This could be done with:

    if array.find { |e| e == element }
    puts "#{element} found in array!"
    else
    puts "#{element} not found in array!"
    end

    Alternatively:

    if array.include?(element)
    puts "#{element} found in array!"
    else
    puts "#{element} not found in array!"
    end

    It may not represent your full case, but I find that using the built-in
    iterators generally does more than a for loop in other languages and that
    there's some iterator that will do what is needed.

    -austin
    --
    austin ziegler * [email]austinhalostatue.ca[/email] * Toronto, ON, Canada
    software designer * pragmatic programmer * 2003.08.12
    * 12.14.03




    Austin Ziegler Guest

Similar Threads

  1. #40768 [NEW]: nested foreach break -- infinite loop - serious
    By rave235 at gmail dot com in forum PHP Bugs
    Replies: 3
    Last Post: March 19th, 07:56 PM
  2. for loop break and continue
    By Rich Fox in forum PHP Development
    Replies: 4
    Last Post: September 27th, 12:38 PM
  3. [PHP] for loop break and continue
    By Robert Cummings in forum PHP Development
    Replies: 1
    Last Post: September 25th, 04:30 PM
  4. elegant way of doing something else the last time through a loop?
    By Petre Agenbag in forum PHP Development
    Replies: 7
    Last Post: July 15th, 03:13 PM
  5. Replies: 0
    Last Post: July 15th, 03:13 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139