Re: if else problem
This WebDNA talk-list message is from 2003
It keeps the original formatting.
numero = 54892
interpreted = N
texte = Kenneth Grome wrote:> By the way, I would like to provide one important word of warning here:I failed to reply to this when it was originally posted and I just noticed it still in my inbox.> > The way switch/case works in webdna is to display ALL the matching > cases, not just the first matching case. This is NOT the way > switch/case works in other popular software products!If you duplicate the [case] values (i.e. you wrote bad code), WebCat *will* execute the code in each matching block. I am unsure why returning only the first value is necessarily better; the code is badly written in the first place, and it shouldn't be the interpreter's business to infer what the programmer actually intended to happen.It is true that in C, the command 'break' will skip all remaining case branches. WebDNA is apparently implementing [switch]/[case] as if it were a series of [if] statements, rather than nested [if][else] blocks. If any software package silently ignores the second and subsequent [case] values, any code there is unreachable and effectively null.This is not a bug, as far as I am concerned.John-- John PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4501 Forbes BoulevardSuite HLanham, MD 20706301-459-3366 x.5010fax 301-429-5748-------------------------------------------------------------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 Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Kenneth Grome wrote:> By the way, I would like to provide one important word of warning here:I failed to reply to this when it was originally posted and I just noticed it still in my inbox.> > The way switch/case works in webdna is to display ALL the matching > cases, not just the first matching case. This is NOT the way > switch/case works in other popular software products!If you duplicate the [case] values (i.e. you wrote bad code), WebCat *will* execute the code in each matching block. I am unsure why returning only the first value is necessarily better; the code is badly written in the first place, and it shouldn't be the interpreter's business to infer what the programmer actually intended to happen.It is true that in C, the command 'break' will skip all remaining case branches. WebDNA is apparently implementing [switch]/[case] as if it were a series of [if] statements, rather than nested [if][else] blocks. If any software package silently ignores the second and subsequent [case] values, any code there is unreachable and effectively null.This is not a bug, as far as I am concerned.John-- John PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4501 Forbes BoulevardSuite HLanham, MD 20706301-459-3366 x.5010fax 301-429-5748-------------------------------------------------------------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 Web Archive of this list is at: http://webdna.smithmicro.com/
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:
Text data with spaces in them... (1997)
Macs and SQL (2000)
New servers and new inline cache (1997)
convertchars and case? (1998)
searching by part of the date information (1999)
Number of Line Items (1998)
repost: I'd like the image this chunk of WEBDNA returns to be hyperlinked to the (2000)
Emailer or [sendmail] questions ... (1998)
auto adding SKUs w/DB helper (1998)
migrating from MacOS to unix (2000)
setlineitem quantity to zero? (2000)
Status? (2000)
Solve the Problem, get the code! (2001)
Textarea Breaks (2000)
This list needs a digest: rant, rave... (1997)
variable value locked when passed to include (2001)
WebCat2 several catalogs? (1997)
Hiring: Web programmer in Seattle area (2000)
Formulas.db + Users.db (1997)
Another Newbie Q: template? (1999)