<commit_before>---
title: Logical Operators
---
## Logical Operators

**AND (&&)** </br>
A&&B returns True if both A and B are True. If either A or B (or both) are False, then A&&B is False.

| A | B |AND(A,B)|
|---|---|---|
|  f| t | f |
|  f| f | f |
|  t| t | t |
|  t| f | t |


**OR (||)** </br>
A||B returns True if A or B (or both A and B) is True. Only returns False if both A and B is False.

| A | B |OR(A,B)|
|---|---|---|
|  f| t | t |
|  f| f | f |
|  t| t | t |
|  t| f | t |

**NOT (!)** </br>
Returns the opposite value. Ex. if A is true, then !A is false, and if A is false, then !A is true. This is the only logical operator that works on only one input, which makes it a unary operator.

| A | B |NOT(A)| NOT(B)
|---|---|---|---|
|  f| t | t |f|
|  f| f | t |t|<commit_msg>change answer to f (#23918)<commit_after>---
title: Logical Operators
---
## Logical Operators

**AND (&&)** </br>
A&&B returns True if both A and B are True. If either A or B (or both) are False, then A&&B is False.

| A | B |AND(A,B)|
|---|---|---|
|  f| t | f |
|  f| f | f |
|  t| t | t |
|  t| f | f |


**OR (||)** </br>
A||B returns True if A or B (or both A and B) is True. Only returns False if both A and B is False.

| A | B |OR(A,B)|
|---|---|---|
|  f| t | t |
|  f| f | f |
|  t| t | t |
|  t| f | t |

**NOT (!)** </br>
Returns the opposite value. Ex. if A is true, then !A is false, and if A is false, then !A is true. This is the only logical operator that works on only one input, which makes it a unary operator.

| A | B |NOT(A)| NOT(B)
|---|---|---|---|
|  f| t | t |f|
|  f| f | t |t|
{'fraction_non_alphanumeric': 0.22215269086357947, 'fraction_numerical': 0.0031289111389236545, 'mean_word_length': 2.217303822937626, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '925821', 'n_tokens_mistral': 654, 'n_tokens_neox': 645, 'n_words': 285}