jeudi 6 août 2015

Multiple conditions in an if clause

If I have an if statement that needs to meet these requirements:

if(cave > 0 && training > 0 && mobility > 0 && sleep > 0)

Is there any way to say that all of them are bigger than zero? Just for more efficient DRY code?

Something like:

if(cave, training, mobility, sleep > 0)

Aucun commentaire:

Enregistrer un commentaire