Re: [WebDNA] SWITCH/CASE or SHOWIF

This WebDNA talk-list message is from

2008


It keeps the original formatting.
numero = 101490
interpreted = N
texte = On Nov 20, 2008, at 1:39 PM, Ki Song wrote: >>> 1. To go through 100 different choices, is a switch/case more >>> efficient or 100 showif statements more efficient? >> I dunno, I would guess that one switch case is faster; at least in >> other languages, when you evaluate once instead of many times, it's >> faster. > > I guess the only way to find out is to test it. > >>> 2. In the final generated HTML code, when 100 SHOWIF statements >>> are processed, but only 1 is actually shown, the other 99 SHOWIF >>> statements create line breaks. Is there a way to prevent the line >>> breaks from showing up if a showif does not evaluate to true? >> anywhere you don't want the line break to appear when webdna spite >> out the html then just wrap it with the webdna comment tag, like >> this one [!] >> [/!] > > Doesn't that prevent the DNA code from being evaluated? No. Just make sure you only use line breaks this way (when you decide to comment them out w/WebDNA) where/when they border/touch the *value* of a tag's parameter, as opposed to trying to break up the parameter's name. It's kind if like webdna is forgiving when/where it still has no idea what you are going to stick in for the param's value... but is less forgiving where it fully well knows how it's tag's params are defined. Post a snip of your code where you are contemplating this and I can show you what I mean. > Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] SWITCH/CASE or SHOWIF (Ki Song 2008)
  2. Re: [WebDNA] SWITCH/CASE or SHOWIF ("Dan Strong" 2008)
  3. Re: [WebDNA] SWITCH/CASE or SHOWIF (Toby Cox 2008)
  4. Re: [WebDNA] SWITCH/CASE or SHOWIF (Govinda 2008)
  5. Re: [WebDNA] SWITCH/CASE or SHOWIF ("Dan Strong" 2008)
  6. Re: [WebDNA] SWITCH/CASE or SHOWIF (Ki Song 2008)
  7. Re: [WebDNA] SWITCH/CASE or SHOWIF (Govinda 2008)
  8. [WebDNA] SWITCH/CASE or SHOWIF (Ki Song 2008)
On Nov 20, 2008, at 1:39 PM, Ki Song wrote: >>> 1. To go through 100 different choices, is a switch/case more >>> efficient or 100 showif statements more efficient? >> I dunno, I would guess that one switch case is faster; at least in >> other languages, when you evaluate once instead of many times, it's >> faster. > > I guess the only way to find out is to test it. > >>> 2. In the final generated HTML code, when 100 SHOWIF statements >>> are processed, but only 1 is actually shown, the other 99 SHOWIF >>> statements create line breaks. Is there a way to prevent the line >>> breaks from showing up if a showif does not evaluate to true? >> anywhere you don't want the line break to appear when webdna spite >> out the html then just wrap it with the webdna comment tag, like >> this one [!] >> [/!] > > Doesn't that prevent the DNA code from being evaluated? No. Just make sure you only use line breaks this way (when you decide to comment them out w/WebDNA) where/when they border/touch the *value* of a tag's parameter, as opposed to trying to break up the parameter's name. It's kind if like webdna is forgiving when/where it still has no idea what you are going to stick in for the param's value... but is less forgiving where it fully well knows how it's tag's params are defined. Post a snip of your code where you are contemplating this and I can show you what I mean. > Govinda

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:

Re:Removing items from a cart is wonky... (1998) One more try (1997) random images (1997) Dummy Credit Card Number for debug? (1997) Quit revisited (1997) Overiding the sku (2001) Protect (1997) Multiple 'Users.db' files not possible (1997) taxTotal (1997) Emailer setup (1997) [WebDNA] Innovative Merchant Solutions (2008) [WebDNA] lists opinion (2009) OFF-TOPIC: Check www.godaddy.com for me ... (2003) autocommit problem (1998) Multiple catalog databases and showcart (1997) emailer w/F2 (1997) [REDIRECT url=http://isd.smithmicro.com/] into New Window? (2002) Still online from NY (2003) OUTSIDE LINKS TO SHOW SHOPPING CART????????? (1998) PCS Customer submissions ? (1997)