From: Joel Pearson Date: 2013-01-06T07:29:38+09:00 Subject: Re: Best practice for &&, ||, and, or Dave Aronson wrote in post #1091164: > On Sat, Jan 5, 2013 at 7:35 AM, wrote: > >> The GitHub Ruby Styleguide [1] states: "The and and or keywords are banned. >> It's just not worth it. Always use && and || instead". > > That's what I do. You've already been quoted the Ruby Style Guide, so > that leaves using the verbal versions for control flow. I've tried to > get used to that, and frankly it just doesn't seem anywhere near as > clear as "if this_fails do_that". Using and/or for control flow is a > popular idiom in Perl, but that doesn't say anything about its clarity > (at least, anything positive), which is very important to Rubyists. > > -Dave There's only one time I can think of where I use "or" for the sake of readability. I'll often have a main method call a series of other methods, each of which returns a boolean, and sets the error level as a way of reporting failure. That is then passed to the errorhandler. This leads to some simple lines like this: boolean_return_method or fail -- Posted via http://www.ruby-forum.com/.