🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #3375

Re: ap, Windows Basic

#3375
From: Mike (My Watch Has Windows) Meye...
Date: Mon, 24 Jun 1991 20:11
52 lines
2413 bytes
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.

	<mike

--
So this is where the future lies			Mike Meyer
In a beer gut belly; In an open fly			mwm@pa.dec.com
Brilcreamed, acrylic, mindless boys			decwrl!mwm
Punching, kicking, making noise
Technical Details
Message-ID: <MWM.91Jun24151113@raven.pa.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!bacchus!mwm
References: <91175.151747F0O@psuvm.psu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <MWM.91Jun24151113@raven.pa.dec.com>
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