[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
code snippet
- Subject: code snippet
- From: Ken Mankoff <mankoff(at)lasp.colorado.edu>
- Date: Tue, 29 May 2001 12:17:50 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: University of Colorado, Boulder
- Reply-To: Ken Mankoff <mankoff(at)lasp.colorado.edu>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:25136
Hi everyone,
i just ran across this in an IDL (its inside 'map_continents.pro')
procedure, and thought its behaviour was pretty neat. Maybe you all know
this already, but hopefully not, and hopefully someone will find it
useful. here goes:
IDL> key = 2
IDL> ;;; set 'key' to 0 or 1 or 2 or ...
IDL> possibilities = ['first','second','third','fourth']
IDL> choice = (possibilities)[key]
IDL> help, choice
CHOICE STRING = 'third'
IDL>
-k.
--
Ken Mankoff
LASP://303.492.3264
http://lasp.colorado.edu/~mankoff/