mercredi 24 février 2016

Test Multiple Variables against a single value in Swift

Is there any pretty way to test the below? I have multiple parameters which I need to know if any one of them is nil

This is what I am using now, I am sure there is an efficient way to test all and type nil once but not sure how:

if title == nil || name == nil  || height == nil || productName == nil {
            //Do something
        }

Aucun commentaire:

Enregistrer un commentaire