From: neverland@... (Pete) Date: 2006-09-28T08:45:06+09:00 Subject: Re: Ahh, the hazards of an interpretive language... In article <4nvv12FcdigrU1@individual.net>, Robert Klemme wrote: >Pete wrote: >> >> def tt x >> if x == :this >> return "got this" >> elseif x == :that >> return "got that" >> end >> ## ... more actions if neither is true >> end > >Btw, the typical solution in Ruby would be to use a Hash. Then tt will >boil down to "def tt(x) your_hash[x] end". The next best solution (and >also more similar to what you did) is a case statement Yes, of course, but the actual actions were rather more complex than just returning a value. That was just for illustration... I could (and probably eventually would) have used a case, as there were several other possible flag values, but code evolves, y'know... (:-)) > > >> Oh well. At least it's the sort of slip one doesn't repeat. > >Certainly. :-) (:-)) Thanks for the suggestions. My learning curve is ever upward... -- Pete -- -- ============================================================================ The address in the header is a Spam Bucket -- don't bother replying to it... (If you do need to email, replace the account name with my true name.)