DEV Community

Discussion on: What language features/concepts do insiders of the language love and outsiders hate?

Collapse
 
databasesponge profile image
MetaDave 🇪🇺

if thing_is_false would be better of course.

Collapse
 
val_baca profile image
Valentin Baca

It depends on context of course, but in general I tend to disagree. Keeping booleans as the "positive" form seems to make things easier.

I really like to use unless for checking state and arguments at the beginning of methods:

(pseudocode)

unless has_coffee:
  throw UncaffeinatedDeveloperError()