From: "David A. Black" Date: 2010-01-01T20:20:04+09:00 Subject: Re: Why can't I use "or" here? Hi -- On Thu, 31 Dec 2009, 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") > > 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. It's not supposed to; it's supposed to read as Ruby :-) I wouldn't make too much of the English-likeness. I think of it more as an emergent thing than as a style guideline. David -- David A. Black Senior Developer, Cyrus Innovation Inc. THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally! January 22-23, Tampa, Florida Info and registration at http://www.thecompleatrubyist.com