Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Unless would drive me insane. I do use IF NOT but when reading code my brain understands this format most clearly:

IF some-expression

ELSE Do-something



`unless` is generally used for guard clauses (eg `return unless authorized?`) or when there’s only one branch. You don’t tend to see `unless` used with multiple branches.


This, I’ve mostly used unless with guard clauses




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: