logical operator
An operator such as AND, OR or NOT that combines or reverses true-or-false conditions.
In more detail
AND is true only if both sides are true, OR if either is, and NOT reverses a condition. NOT binds most tightly, then AND, then OR, so a OR b AND c means a OR (b AND c); add brackets to say what you mean. Many languages write them as the words and, or and not, or as symbols such as &&, || and !, and stop evaluating as soon as the answer is known.
Examples
Rego ANDs lines in one body and ORs rules with the same nameIn a NetworkPolicy, two selectors in one peer are AND; two peers are OR0 < x and x < 10Detection rules are built from them.Related terms
- Rego — The policy language of Open Policy Agent, in which rules are sets of conditions over JSON input.
- label selector — A query that picks objects by their labels, such as every pod with app=web; controllers and Services depend on it.
- WHERE clause — The part of a query that keeps only the rows for which a condition is true.
- three-valued logic — SQL's rule that a condition can be true, false or unknown, where unknown comes from comparing with NULL.
- operator precedence — The rules that decide which operators in an expression are applied first, such as multiplication before addition.
- Boolean — A value that can only be true or false.
- short-circuit evaluation — Stopping the evaluation of and or or as soon as the answer is certain, so the right-hand side may never run.
- condition — An expression that is tested for being true or false, such as weight > 50, to decide what a program does next.
- truthiness — How Python treats any value as true or false in a condition: zero, empty collections, empty strings and None are false; nearly everything else is true.
- Sigma — An open, vendor-neutral format for writing SIEM detection rules in YAML, which tools convert into each SIEM's own query language.
- SELECT — The SQL statement that reads data: it names the columns you want in the answer and, with FROM, the tables they come from.
Taught in
- Kubernetes NetworkPolicies & Microsegmentation — Cloud Security & DevSecOps Engineering
- Policy-as-Code Architecture: OPA & Rego Syntax — Cloud Security & DevSecOps Engineering
- The Merge Request That Deployed To Production — GitLab Certified CI/CD Associate Exam Prep
- A Copy Of The Backup: etcd — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- One Dash Too Many: Segmentation With Network Policy — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Fundamentals Sprint: Four Findings, Eight Questions — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Objects, Methods And String Case — Hands-on Python: Complete Video Course & Book
- If Else, And Conditional Expressions — Hands-on Python: Complete Video Course & Book
- Compound Boolean Expressions — Hands-on Python: Complete Video Course & Book
- Any Type As A Condition — Hands-on Python: Complete Video Course & Book
- Chapter Three In One Sitting — Hands-on Python: Complete Video Course & Book
- Detection as Code: Authoring & Testing Sigma Rules — Security Operations & Threat Hunting (SOC)
- YARA Rule Authoring & File Signature Matching — Security Operations & Threat Hunting (SOC)
- Filtering With The WHERE Clause — PostgreSQL, Indexing & Relational Data Modeling
- Operators And Who Binds First — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Conditions The Exam Loves — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Mock, Review And Exam Day — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Comparing, Slicing And Never Changing — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
References
- PostgreSQL documentation: logical operators
- SQLite: operators
- Expressions: Boolean operations
- SQLite: expressions and operators
Certification courses
- GitLab CI/CD Associate course and practice exam: GitLab Certified CI/CD Associate
- KCSA course and practice exam: Kubernetes and Cloud Native Security Associate
- PCEP course and practice exam: Certified Entry-Level Python Programmer
- PCAP course and practice exam: Certified Associate in Python Programming