Hacker News new | ask | show | jobs
by edu 3795 days ago
It's idiomatic ruby.

First as the conditional only has one statment it's preferred to write it in its shorthand way, so instead of

  if a.bytesize != b.bytesize
    return false
We start by writing

  return false if a.bytesize != b.bytesize
And then unless is the negated conditional, so we rewrite it as

  return false unless a.bytesize == b.bytesize
Which some peolpe (myself included) consider easier to read, the 'unless' is easier to note (more chars) than the '!='.