jeudi 17 novembre 2016

How to use || and && togather in one if statement

I am trying to check if the first day is equal to five or 6, in both cases if total days is equal to 31 then do something, for that purpose which statement is correct ?

 1. if (firstday > 5 || firstday > 6 && totalDays == 31){}

 2. if (firstday > 5 && totalDays == 31 || firstday > 6 && totalDays == 31) { }

Aucun commentaire:

Enregistrer un commentaire