Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!ra!uvaarpa!vger.nsu.edu!g_harrison From: g_harrison@vger.nsu.edu (George C. Harrison, Norfolk State University) Newsgroups: comp.lang.pascal Subject: Re: case (string) of Message-ID: <1048.284bd1ff@vger.nsu.edu> Date: 4 Jun 91 21:46:39 GMT References: <1991Jun3.222059.16125@javelin.sim.es.com> Lines: 26 In article <1991Jun3.222059.16125@javelin.sim.es.com>, tpehrson@javelin.sim.es.com (Tim Clinkenpeel) writes: > so i can't use case for strings, eh? what are my alternatives? a list of > if-thens? (tp5.0) > > -- > /=============================/ > / tpehrson@javelin.sim.es.com / i will work for food > /=====aka: tim clinkenpeel====/ > [DISCLAIMER: send SASE to: disclaimer, 84151-0521] I'm not a TP expert, but Pascal (in general) does not allow nondiscrete types in case statements. STRING is definitely nondiscrete! A list of if-then's in not so bad if you structure them correctly. After all isn't that what case is all about? As an alternative you may want to convert the string or part thereof to an enumerated type and use a variable of that type in the case statement; however, in general, this does not allow for string's that don't conform to the type. George... -- George C. Harrison ----------------------- ----- Professor of Computer Science ----------------------- ----- Norfolk State University ----------------------- ----- 2401 Corprew Avenue, Norfolk, Virginia 23504 ----------------------- ----- INTERNET: g_harrison@vger.nsu.edu ---------------------------------