Wikipedia:
Logical operators
AND, NAND, OR, XOR and NOT are the main logical operators, basis for the construction of digital systems and propositional logic, and also widely used in programming language. The operators AND, NAND, OR and XOR are binary operators, that is, they need two elements, while NOT is unary. In computation, these elements are usually binary variables, whose possible assigned values are 0 or 1. However, the logic used for these variables also serves for sentences (sentences) of the human language, where if this is true corresponds to the value 1, and if false is 0.
AND
Logical operator in which the operation response is true (1) if both input variables are true.
x1 x2 x1 AND x2
0 0 0
0 1 0
1 0 0
1 1 1
NAND
Logical operator in which the operation response is true (1) if at least one of the variables is false.
x1 x2 x1 NAND x2
0 0 1
0 1 1
1 0 1
1 1 0
OR
Logical operator in which the operation response is true (1) if at least one of the input variables is true.
x1 x2 x1 OR x2
0 0 0
0 1 1
1 0 1
1 1 1
XOR
Logical operator in which the operation response is true (1) when variables assume different values from each other.
x1 x2 x1 XOR x2
0 0 0
0 1 1
1 0 1
1 1 0
NOT
Logical operator representing the negation (inverse) of the current variable. If it is true, it becomes false, and vice versa
x1 NOT x1
0 1
1 0
Source: https://pt.wikipedia.org/wiki/Operador_lógico
Logic gate
I find this subject off-topic, because even if it has some context similar to programming I still do not know if it is totally comprehensive, although doubts of algorithms are accepted, yet the doubt is not about a specific algorithm, Yet only to make a difference:
Logic gates or logic circuits are devices that operate one or more logic input signals to produce one and only one output, dependent on the function implemented in the circuit. They are usually used in electronic circuits, because of the situations that the signals of this type of circuit may present: presence of signal, or "1"; and absence of signal, or "0". The situations "Truth" and "False" are studied in Mathematical Logic or Boole Logic; origin of the name of these gates. The behavior of logic gates is known by the truth table that presents the logical states of inputs and outputs.
AND
ENTRADA SAÍDA
A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1
OR
ENTRADA SAÍDA
A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1
NOT
ENTRADA SAÍDA
A NOT A
0 1
1 0
NAND
ENTRADA SAÍDA
A B A NAND B
0 0 1
0 1 1
1 0 1
1 1 0
NOR
ENTRADA SAÍDA
A B A NOR B
0 0 1
0 1 0
1 0 0
1 1 0
XOR
ENTRADA SAÍDA
A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0
XNOR
ENTRADA SAÍDA
A B A XNOR B
0 0 1
0 1 0
1 0 0
1 1 1
Source: https://en.wikipedia.org/wiki/Logic_gate
I think this question seems to have more to do with electronics than with programming.
– user28595
But gate logic has to do with introduction to electronics.
– user28595
Duplicate
– Avelino
It’s the same thing. Only logic ports are hardware implementations using transistors and logical operators are software implementations that use processor registers.
– Avelino
Now that you have an answer, you can harm her even more, if she runs away from what was answered.
– user28595
I think it’s interesting for the programmer to understand how logic gates work, I believe that getting a sense of how things work can help in some situations, often during programming we are used to using a lot OR and E as conditional, and in some cases, the implementation of a XOR port can solve a problem that locks us.
– Lucas Queiroz Ribeiro
In my opinion you shouldn’t change your question. Anyone who does computing usually has a Computer Architecture subject where they superficially study logic gates. I don’t think it’s duplicated either. The reply @Avelino gave in the comment is already an answer in itself and should be posted as such.
– cantoni
I will add the difference between logical ports and logical operators here
– Avelino