mercredi 28 octobre 2020

How to refactor my code with if (condition) { return } [closed]

For example, i have several functions needing to check the age of a patient. They must return false if patient.age < 10 so i write :

if (patient.age < 10) {
  return false
}

How can i do to have these 3 lines above in one function call ? Is it possible ? I need to do that in javascript and java.

Thanks

Aucun commentaire:

Enregistrer un commentaire