samedi 27 février 2021

OR operator inside of If statements

else if (!emailGet.endsWith(".com") && !emailGet.endsWith(".info")){ 
            
            errors += "Email should end with .info or .com";
        }

Why is "&&" playing the role of an "OR" statement, but when I use "OR" itself it does nothing, the only way I can get the code to tell me if one or the other statement is true is by using "&&" which evaluates 2 statements unlike "OR, the logic behind using "&&" makes no sense to me, am I missing something?

Aucun commentaire:

Enregistrer un commentaire