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:

MacAuthorize order data fields WAS:How To question... (1997) webcat NT with [dos] command (1997) [WebDNA] Screen Resolution - detection & redirect (2012) RE: Web*SSL and WebCatalog (1997) Protect (1997) Help with (2003) Using Applescript to process WebCatalog functions (1998) WebCat2 as a chat server? (1997) suffix mapping for NT? (1997) Cart Numbers (1997) WebCat2b13MacPlugIn - [shownext method=post] ??? (1997) Need help!! on searching in two databases. (1998) DB Updates don't take (1998) [WebDNA] What's the next step? (2015) Change Subtotal (2000) Credit Card Number checking (1997) Re:trouble (1997) Grepping a csv (2003) Multi-processor Mac info ... (1997) Exclamation point (1997)