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:

Webcat 4.0 and security (2000) 3.0 [TEXT] variables (1998) NT version and O'reily's WebSite (1997) Changes to [ReturnRaw] in 3.0 (1998) [Announce]: Web server security and password protection (1997) [math] show=F exists? (1997) Re1000001: Setting up shop (1997) How true is this? (1999) Testing, Sorry (1998) WebCat2: Found Items syntax, etc. (1997) Include a big block of text (1997) Major Security Hole (1998) Re1000001: Setting up shop (1997) RE: [WebDNA] Writing to db in memory, but not to file (2012) OT: How to get more traffic to a site? (2005) No data - More Info (1997) Searching multiple criteria (2000) Cumulative Shipping charge calculations - your help please. (1997) Apache Question (2003) more info on [setlineitems] (1997)