jeudi 18 juin 2015

Is there a way to shorten my if(word.Contains("tree") ||word.Contains("water")||word.Contains("sky")) [duplicate]

This question already has an answer here:

Pretty much what the title says, I got a big if-sentence with ~5Contains this is not nicely looking if I repeat this a few times, is there any way to shorten this?

if(word.Contains("tree") ||word.Contains("water")||word.Contains("sky")||word.Contains("lake")||word.Contains("plant"))
{
//do something
}

Aucun commentaire:

Enregistrer un commentaire