From: dblack@... Date: 2003-01-28T10:11:21+09:00 Subject: Re: Parsing: x = y || raise "error" Hi -- On Tue, 28 Jan 2003, Daniel Carrera wrote: > dir = ARGV.shift || raise "Require directory argument" > > Is probably getting parsed as: > > dir = (ARGV.shift || raise) "Require directory argument" > > When you type > > dir = ARGV.shift || raise("Require directory argument") > > Ruby parses it as > > dir = ARGV.shift || (raise("Require directory argument")) In fact, I believe it's even: dir = (ARGV.shift || (raise("Require directory argument"))) meaning, dir is getting assigned to whether ARGV.shift works or not (the return value of raise). This may not matter, since [].shift == nil and raise returns nil, but still, it's probably good to be aware of. > Use 'or' instead of ||, it has lower precedence. (And solves any weirdness of the above kind :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav