vendredi 11 mai 2018

Why is it better to use positive conditions rather than negative?

I have always been taught to use conditions that ask if true, rather than if not true.

if variable.present? - good
if variable != nil - bad

Why is this the case? What is the downside to asking if something is not true?




Aucun commentaire:

Enregistrer un commentaire