2 ms·
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 th
by KirinDave 16y ago
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.