Re: [LOOP]/[BREAK] bug

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 35550
interpreted = N
texte = It seems pretty clear to me that [break] exits the loop at the end of the current execution; it does not immediately exit. If you want to exit a loop prematurely, place the [break] as the last line of the loop, not the beginning or middle. You also may need to adjust the test around the break, i.e. in your example, if you do not want to exit as soon as start=6 (but not process 6) you need to [SHOWIF [INDEX]=5].John PeacockMichael Winston wrote: > > MAC 3.08-4.0xxx PI > > [BREAK] does funny things depending on where it's placed (mostly, it > executes the last iteration of the loop). This one dates back to at > least 3.08. Although, it's completely possible that I just don't > understand how [BREAK] is supposed to work. > > Compare: > > SOURCE: > [LOOP start=1&end=10] > [INDEX] > [INDEX] > [SHOWIF [INDEX]=6][BREAK][/SHOWIF] > [/LOOP] > > RESULT: > 1 1 2 2 3 3 4 4 5 5 6 6 > > SOURCE: > [LOOP start=1&end=10] > [INDEX] > [SHOWIF [INDEX]=6][BREAK][/SHOWIF] > [INDEX] > [/LOOP] > > RESULT: > 1 1 2 2 3 3 4 4 5 5 6 10 > > SOURCE: > [LOOP start=1&end=10] > [SHOWIF [INDEX]=6][BREAK][/SHOWIF] > [INDEX] > [INDEX] > [/LOOP] > > RESULT: > 1 1 2 2 3 3 4 4 5 5 6 6 10 10 > > ############################################################# > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > To switch to the INDEX mode, E-mail to > Send administrative queries to ############################################################# This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to To switch to the INDEX mode, E-mail to Send administrative queries to Associated Messages, from the most recent to the oldest:

    
  1. Re: [LOOP]/[BREAK] bug (John Peacock 2000)
  2. Re: [LOOP]/[BREAK] bug (Michael Winston 2000)
  3. Re: [LOOP]/[BREAK] bug (John Peacock 2000)
  4. [LOOP]/[BREAK] bug (Michael Winston 2000)
It seems pretty clear to me that [break] exits the loop at the end of the current execution; it does not immediately exit. If you want to exit a loop prematurely, place the [break] as the last line of the loop, not the beginning or middle. You also may need to adjust the test around the break, i.e. in your example, if you do not want to exit as soon as start=6 (but not process 6) you need to [SHOWIF [INDEX]=5].John PeacockMichael Winston wrote: > > MAC 3.08-4.0xxx PI > > [BREAK] does funny things depending on where it's placed (mostly, it > executes the last iteration of the loop). This one dates back to at > least 3.08. Although, it's completely possible that I just don't > understand how [BREAK] is supposed to work. > > Compare: > > SOURCE: > [LOOP start=1&end=10] > [INDEX] > [INDEX] > [SHOWIF [INDEX]=6][BREAK][/SHOWIF] > [/LOOP] > > RESULT: > 1 1 2 2 3 3 4 4 5 5 6 6 > > SOURCE: > [LOOP start=1&end=10] > [INDEX] > [SHOWIF [INDEX]=6][BREAK][/SHOWIF] > [INDEX] > [/LOOP] > > RESULT: > 1 1 2 2 3 3 4 4 5 5 6 10 > > SOURCE: > [LOOP start=1&end=10] > [SHOWIF [INDEX]=6][BREAK][/SHOWIF] > [INDEX] > [INDEX] > [/LOOP] > > RESULT: > 1 1 2 2 3 3 4 4 5 5 6 6 10 10 > > ############################################################# > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > To switch to the INDEX mode, E-mail to > Send administrative queries to ############################################################# This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to To switch to the INDEX mode, E-mail to Send administrative queries to John Peacock

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Generating unique SKU from [cart] - Still Stumped... (1997) HomePage Caution (1997) PIXO with cometsite ... and/or other plugins (1998) b12 cannot limit records returned and more. (1997) Preventing code execution (2003) [Announce]: Web server security and password protection (1997) The Depths of Credit Card Payment (2003) Math Problem - Format? (1997) Secure server question (1997) [redirect] question (2005) Possible Bug in 2.0b15.acgi (1997) RE: protect tag on NT (1997) OS X Line Endings HELL! (2003) Cannot get subtotal to work (1997) WebCatalog 2.0.1 NT beta 1 released (1997) Multiple Merchant Accounts? (1997) Shipping charges depending on tax rate? (1997) Sku numbers (1997) Your personal 5.1 WebDNA Lab now available on the DRC (2003) Correlating the record found with the fieldname (2000)