Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news4.ner.bbnplanet.net!news3.near.net!paperboy.wellfleet.com!news-feed-1.peachnet.edu!usenet.eel.ufl.edu!news.cybercom.net!news.mathworks.com!gatech!swrinde!sdd.hp.com!col.hp.com!news.dtc.hp.com!hpscit.sc.hp.com!hpax!news
From: Trong Nguyen <trong>
Subject: Re: -- SMALLTALK HELP -- If/else or select/case ???
Sender: news@hpax (News Admin)
Message-ID: <DCAqrA.5rn@cup.hp.com>
Date: Wed, 26 Jul 1995 00:01:58 GMT
X-Url: news:3v12u9$477@crchh327.rich.bnr.ca
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
References: <3v0ohp$477@crchh327.rich.bnr.ca> <3v10a5$3ob@atglab10.atglab.bls.com> <3v12u9$477@crchh327.rich.bnr.ca>
Nntp-Posting-Host: tpoina03.cup.hp.com
Mime-Version: 1.0
X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.05 9000/715)
Organization: Hewlett-Packard
Lines: 46

vanchau@bnr.ca (Vanchau Nguyen) wrote:
 
>
>Basically...
>
>myVariable = #case1
>	ifTrue: [dothis].
>
>myVariable = #case2
>	ifTrue: [dothis].
>
>myVariable = #case3
>	ifTrue: [dosomethingelse].
>
>The problem is I am building a linc between an old system and a new system.  I 
>can not change EITHER system, I need to convert data values from one
>for to another.  Since I can not change either system, I guess I'll just
>have to do it the way I showed above.
>
>--
>Vanchau Nguyen
>-[My opinions are my own]-

Vanchau,

You could put them all in a dictionary object. "caseXX' and 'doXXX' are keys
and values, respectively. The 'doXXX' can be method names or objects of some
class. If the values are method names, then the myVariable can be used as
lookup key to retrieve the appropriate method. Arm with the method name, you
can simply invoke 'perform' to execute that method.

Hope this will help.

Trong
--
  _________________________________________________________________________
 /                                                                         \
| Trong V. Nguyen                         Telnet : 1-447-3825               |
| Telecommunications Platform Operation   Phone  : (408) 447-3825           |
| Hewlett-Packard Co                      Fax    : (408) 447-3878           |
| 19111 Pruneridge Ave - MS#43UD          E-mail : trong@cup.hp.com         |
| Cupertino, CA 95014-0691                                                  |
| ------                                                                    |
| Disclaimer: All opinions are of my own, not of my employer.               |
 \_________________________________________________________________________/

