[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Switch/Case statements revisited
- From: Mark Hamburg <mhamburg@...>
- Date: Fri, 09 Nov 2007 18:06:42 -0800
on 11/9/07 1:41 AM, steve donovan at email@example.com wrote:
> My vote is for David Given's suggestion:
> match k
> with 10, 11 then return 1 end
> with 12 then return 2 end
> with i if 13<=i and i<=16 then return 4 end
The English would probably read better with "on" and "do" instead of "with"
I'm not sure what the last clause means unless it's:
if k == i and 13 <= i and i <= 16 then ...
which is an interesting extension to standard case behavior. On the other
hand, it then forces sequential testing rather than simply accepting that as
But I find myself missing switch/case statements relatively rarely.