I got a quick question and I’m too lazy to register on stackoverflow.
Have you ever used any logical operators except OR and AND?
If I ever needed XOR for example, I would write
if(var1 != var2)
If I needed NOR, I would write
if(var1 == false and var2 == false)
I have never thought of that before because I didn’t know any other logical operators, and I have never seen any other used when looking stuff up.
Some of these do exist in some programming languages, but most don’t.
Basically, I need to know whether I’m stupid, or you haven’t used these neither.
What programming language you are learning right now?
This is correct, in Python:
if var1 != var 2:
This is also correct, but many writes it like this in Python:
if not var1 and not var2:
Difference between OR and AND:
OR: either or both are true
AND: both are true
This doesn’t actually answer my question; have you used any logical operators except OR and AND in any programmjng language?
The question is general, not a specific language.
I am only learning Python, HTML, and CSS right now.
Based on w3schools and stackoverflow, there are only three logical operators
There are symbols for them though.
like &&, ||, !
It’s so weird they don’t teach these, and not many languages have these.
Edit: I meant they don’t teach operators except AND, OR, NOT
Non programmer be like… wtf are you all talking about