From: Charles Oliver Nutter Date: 2010-01-01T09:47:53+09:00 Subject: Re: Why can't I use "or" here? On Wed, Dec 30, 2009 at 11:32 PM, Albert Schlef wrote: > Well. it turns out there aren't that many ways in ruby. > > I originally tried to do the following: > >  some_func(ARGV[0] or raise "You must provide an argument") First off, I'd say that this is probably confusing form to use. If I ever saw this in code I'd write it differently. > I wish it worked. But it doesn't. So I changed it to: > >  some_func(ARGV[0] || raise "You must provide an argument") > > It still didn't work. So finally I did: > >  some_func(ARGV[0] || (raise "You must provide an argument")) > > It works. But, I must say, it isn't as beautiful as my original plan. It > doesn't read as English. This isn't too bad, for what you want: some_func ARGV[0] || raise('you must provide an argument') or: some_func(ARGV[0] || raise('you must provide an argument') And if I were to write this, I'd probably choose one of these variants: ARGV[0] ? some_func(ARGV[0]) : raise 'you must provide an argument' or raise 'you must provide an argument' unless ARGV[0] some_func(ARGV[0]) - Charlie