Xref: utzoo comp.windows.ms.programmer:3288 alt.religion.computers:2559 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!bacchus!mwm From: mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) Newsgroups: comp.windows.ms.programmer,alt.religion.computers Subject: Re: ap, Windows Basic Message-ID: Date: 24 Jun 91 20:11:13 GMT References: <91175.151747F0O@psuvm.psu.edu> Sender: news@pa.dec.com (News) Organization: Missionaria Phonibalonica Lines: 52 In-Reply-To: F0O@psuvm.psu.edu's message of 24 Jun 91 19:17:47 GMT In article <91175.151747F0O@psuvm.psu.edu> F0O@psuvm.psu.edu writes: F0O@psuvm.psu.edu writes: > In article <4k4q47w164w@mantis.co.uk>, mathew@mantis.co.uk (Giving C News a > *HUG*) says: > > This segment will match strings that are exactly equal to "everything" > the current value of AnotherString, or that fall between "nuts" and "soup" > in alphabetical order > > SELECT CASE AStringVariable > CASE "everything", "nuts" TO "soup", AnotherString > ... > END SELECT >>That's just >> IF AStringVariable = "everything" OR AStringVariable = AnotherString OR >> (AStringVariable > "nuts" AND AStringVariable < "soup") >> ... >> ELSE >> ... >> ENDIF >> >>In other words, the SELECT CASE you mention is just syntactic sugar for >>IF...ELSE...ENDIF. True, it is window dressing. But this window dressing takes up less lines(which would be appreciated if you're doing ALOT of comparisons and it looks cleaner(in my opinion). Actually, it's not "just syntactic sugar"; at least if they did it right. Can I do: SELECT CASE string1 + string2 CASE "everything", "nuts" TO "soup", AnotherString ... END SELECT If it let me use expressions for the "index" expressions, then mapping it into an elseif chain requires a scratch variable. If that meets your criteria of "sugar", then everything is sugar on top of "if else" and "while"; and you may not even need the while. Of course, if it insists on keywords in UPPER CASE, that negates minor things like getting the case statement right.