RE: Feature request (Can do Switch)

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 21633
interpreted = N
texte = Greetings, Harry here uses this technique to get switch-like statement. As soon as the first case holds true, the loop exists. If none hold true, the else statement is executed.Embedd this in your template and add your case statments accordingly.Aloha, Olin=== [math show=f]else=0[/math] [loop start=1&end=3] [showif [index]=1] [showif [num]=1] One [math show=f]else=1[/math][break] [/showif] [/showif] [showif [index]=2] [showif [num]=3] Two [math show=f]else=1[/math][break] [/showif] [/showif] [showif [index]=3] [showif [num]=3] Three [math show=f]else=1[/math][break] [/showif] [/showif] [loop] [showif [math]else[/math]=0] your else statement here... [/showif] ===> -----Original Message----- > From: Brian Fries [mailto:brainscn@psyber.com] > Sent: Monday, December 07, 1998 3:37 PM > To: WebDNA-Talk@smithmicro.com > Subject: Feature request > > > I have seen requests for an syntax along the lines of > > [if] > blah > [else] > blah > [/if] > > which would be nice, but what I'd REALLY like to see is a SWITCH/CASE > statement, something like this: > > [SWITCH {expression}] > [CASE {value1}] > blah > [/CASE] > [CASE {value2}] > blah > [/CASE] > [CASE {value3}] > blah > [/CASE] > ... > [DEFAULT] > blah > [/DEFAULT] > [/SWITCH] > > So, each [CASE] would be the equivalent of > > [SHOWIF {expression}={valueX}] > > and the [DEFAULT] context would be shown if {expression} doesn't equal any > of the {values} specified in the [CASE] contexts. > > The current workarounds for the lack of a SWITCH make for complicated and > ugly code that is difficult to debug and update. > > Brian > > <=- Brian C. Fries, BrainScan Software -=> > <=- Macintosh, Internet and Multimedia -=> > <=- Development and Consulting -=> > <=- brainscn@psyber.com -=> > <=- http://www.psyber.com/~brainscn -=> > <=- http://www.extremeaudio.com -=> > <=- http://www.carboload.com (coming soon) -=> > > > Associated Messages, from the most recent to the oldest:

    
  1. RE: Feature request (Can do Switch) (Olin Lagon 1998)
Greetings, Harry here uses this technique to get switch-like statement. As soon as the first case holds true, the loop exists. If none hold true, the else statement is executed.Embedd this in your template and add your case statments accordingly.Aloha, Olin=== [math show=f]else=0[/math] [loop start=1&end=3] [showif [index]=1] [showif [num]=1] One [math show=f]else=1[/math][break] [/showif] [/showif] [showif [index]=2] [showif [num]=3] Two [math show=f]else=1[/math][break] [/showif] [/showif] [showif [index]=3] [showif [num]=3] Three [math show=f]else=1[/math][break] [/showif] [/showif] [loop] [showif [math]else[/math]=0] your else statement here... [/showif] ===> -----Original Message----- > From: Brian Fries [mailto:brainscn@psyber.com] > Sent: Monday, December 07, 1998 3:37 PM > To: WebDNA-Talk@smithmicro.com > Subject: Feature request > > > I have seen requests for an syntax along the lines of > > [if] > blah > [else] > blah > [/if] > > which would be nice, but what I'd REALLY like to see is a SWITCH/CASE > statement, something like this: > > [SWITCH {expression}] > [CASE {value1}] > blah > [/CASE] > [CASE {value2}] > blah > [/CASE] > [CASE {value3}] > blah > [/CASE] > ... > [DEFAULT] > blah > [/DEFAULT] > [/SWITCH] > > So, each [CASE] would be the equivalent of > > [SHOWIF {expression}={valueX}] > > and the [DEFAULT] context would be shown if {expression} doesn't equal any > of the {values} specified in the [CASE] contexts. > > The current workarounds for the lack of a SWITCH make for complicated and > ugly code that is difficult to debug and update. > > Brian > > <=- Brian C. Fries, BrainScan Software -=> > <=- Macintosh, Internet and Multimedia -=> > <=- Development and Consulting -=> > <=- brainscn@psyber.com -=> > <=- http://www.psyber.com/~brainscn -=> > <=- http://www.extremeaudio.com -=> > <=- http://www.carboload.com (coming soon) -=> > > > Olin Lagon

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:

Interactive Docs (2007) WebCat editing, SiteGuard & SiteEdit (1997) Help! WebCat2 bug (1997) suffix mapping for NT? (1997) carriage returns in data (1997) Webten + Webcat running smooth (1998) Assigning new CART number (1997) [WebDNA] preventing hackers from posting their own (altered) (2009) [BULK] [WebDNA] [BULK] WebDNA 7 - Ready or Not ?? I'm not sure... (2011) problems with WebCat-Plugin (1997) includes and cart numbers (1997) [Sum] function? (1997) search form problem.. (1997) [ShowIf] and empty fields (1997) sendmail for email (was Netforms) (1998) CreateDate and ModDate issues (2004) Search and sort (2001) [input] [/input] (1997) flushdatabases (1997) sort problems....bug or brain fart? (1997)