[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

code snippet



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/