Re: loop do .. until end loop is surely incorrect!

new topic     » goto parent     » topic index » view thread      » older message » newer message
petelomax said...

You can always (in all the examples you gave, and any possible use of with entry) replace

  while <condition> with entry do 
    <block a> 
  entry 
    <block b> 
  end while 

with

  while 1 do 
    <block b> 
    if not <condition> then exit end if 
    <block a> 
  end while 

So I'm not letting you have the duplicate code argument.

Yes, that's just as correct, functionally. I really prefer to stay away from while 1 do, since it serves (IMHO) to obfuscate the exit criterion inside the loop.

I think we're getting into a style/religious war on the level of proper brace position, however, and like Derek, I'll agree to disagree. smile

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu