From: Justin Collins Date: 2007-12-04T16:25:57+09:00 Subject: Re: Ruby idiom equivalent to Perl "$asdf = $ARGV[0] || die 'arg required'"? Justin Collins wrote: > Giles Bowkett wrote: >> I'm making some command-line utilities easier to use and I was >> wondering if there's a really nice simple Rubyish way to do what I >> used to do with Perl back in the day. All my code in these utils which >> exit and print usage strings in the absence of required command-line >> args is looking kinda clunky to me. >> >> > > Are you saying you _do_ want something like the example you gave? > > var = ARGV[0] || raise("Argument required") > > > -Justin I guess you can get rid of the parentheses, too. var = ARGV[0] or raise "Argument required"