mardi 3 avril 2018

IF statement using AND and OR conditions together - R

I am looking at some code which reads like this

if(X[i] && Y[i] == 'string1' || 'string2' || 'string3'){
do thing
}

The idea being, if both X and Y match any of the three strings, the statement executes.

When I read it aloud it makes sense to me but clearly the syntax is wrong.

Aucun commentaire:

Enregistrer un commentaire