The OR operator,or a mystery to me


i passed the exercise, but i really dont get why the OR operator works like this :
else if(!(iLoveJavaScript || iLoveLearning))
why is this an OR operator when the code wants to check if both variables are false ?


These two lines are like a substitute for writing or. For example when you want to account for two different outcomes in an if statement.


Thanks for your answer
what i meant is that in my head this is an AND situation while there is an OR here, like this:

if(illovejavascript AND ilovelearning are False)...
but here, instead of the AND there is an OR
so why isnt it written if(iLoveJavaScript && iLoveLearning)
see what i mean ? i get what or means, just not why it's here in a situation when they both need to be false, and not just one of them, so this is only aimed at one outcome : both falses (if i get this exercise right of course :slight_smile: )


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.