Hacker News new | ask | show | jobs
by deathanatos 2756 days ago
Why can that not be swapped to:

  guard let array = obj.someArray,
        0 < array.count else {
      throw SomeError
  }

?
1 comments

It could be changed to that, but what am I really asking? "Is zero lower than the length of my array" is a bizarre way to word the question, as opposed to "is the length of my array greater than zero".

I believe in self-documenting and obvious code, and I think if statements should read as much like a human sentence as possible.