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:
off-topic: SMS interface? (2001)
RE: Symantec VIsual Page 1.0.3 (1997)
passing large amount of text in post form (2005)
Formating found categories (1997)
Editing Users.db (1997)
problem with dates, NT version (1997)
Calendar using WebCatalog? (1997)
Suddenly can't see files... (2000)
Location of Browser Info.txt file (1997)
[WebDNA] [session] (2018)
slightly OT: advertising schemes (2004)
A question on sub-categories (1997)
Catalogs and W* (1996)
Progress !! WAS: Trouble with formula.db (1997)
Was 5.0 Pricing, now Sandbox versus Website and ruminating (2003)
webcat NT (1998)
Verifying both name and password (was: THANKS) (1997)
WebCatalog/Mac 2.1b2 New Features (1997)
Time comparison question (1998)
Authenticate (1997)