From: botp Date: 2009-04-30T08:32:02+09:00 Subject: Re: Can this code be more succinct On 4/30/09, Mark Thomas wrote: > but I'm not sure whether the number of args check can be handled > inside the case. I tried a 'when ARGV.size > 1' but you can't put a > full expression in a when statement. > there's another form for case. try this (untested), arg = ARGV[0] case when ARGV.size > 1 abort "too many args ;-)" when /^os$/ =~ arg sym = arg.downcase else abort "ERROR: invalid arg #{arg}" end