From: Albert Schlef Date: 2009-12-31T14:39:28+09:00 Subject: Re: Why can't I use "or" here? 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. Hey, I now see that this works: some_func((ARGV[0] or raise "You must provide an argument")) Great. On the other hand, I won't be able to remember this the next time I need it. -- Posted via http://www.ruby-forum.com/.