News for hackers. Stuff that matters.
Re:Using “and” and “or” in Ruby by KirinDave on Monday August 02, 2010 @03:53PM (#1568815)
I like your find-or-begin pattern, and I've used the or operator to pun that way before as well.

But just a note, the if x = ... is not a side effect unless the variable "x" already exists. There's not problem using that as a pun to get rid of lots of if nesting. Similarly if x &&= ... is very good for avoiding an if-cascade, albeit more obscure and perhaps less performant.

It's too bad there isn't a beautiful way to do monads or the thrush operator in Ruby.

There are no comments on this comment yet.