jeudi 24 décembre 2015

How to write a simplified if condition

I have three parameters value1, value2, value3 and I am supposed to check for four different values in them. Is there a simplified way to write the equivalent condition in Java or in JavaScript :

      if ((value1 == 11) || (value1 == 88) || (value1 == 66) || (value1 == 33) || 
          (value2 == 11) || (value2 == 88) || (value2 == 66) || (value2 == 33) || 
          (value3 == 11) || (value3 == 88) || (value3 == 66) || (value3 == 33)) {

Aucun commentaire:

Enregistrer un commentaire