Hacker News new | ask | show | jobs
by ilyt 1279 days ago
and why

    def my_method(required_thing)
      raise 'required_thing is required' if !required_thing.present?
is a problem ?
1 comments

I don't think it's a problem necessarily. "unless" is more obvious to me since since it visually stands out more than "if !required_thing" while I'm casually scanning the code. So, in practice, it acts as an indication from the author of the code to the reader that "this line of code is a guard since we're using an unless".