encyclopegia.org

Boolean expression

In computer science, a Boolean expression (also known as logical expression) is an expression used in programming languages that produces a Boolean value when evaluated. A Boolean value is either true or false. A Boolean expression may be composed of a combination of the Boolean constants True/False or Yes/No, Boolean-typed variables, Boolean-valued operators, and Boolean-valued functions. Boolean expressions correspond to propositional formulas in logic and are associated to Boolean circuits.

In computer science, a Boolean expression (also known as logical expression) is an expression used in programming languages that produces a Boolean value when evaluated. A Boolean value is either true or false. A Boolean expression may be composed of a combination of the Boolean constants True/False or Yes/No, Boolean-typed variables, Boolean-valued operators, and Boolean-valued functions. Boolean expressions correspond to propositional formulas in logic and are associated to Boolean circuits. ==Boolean operators== Most programming languages have the Boolean operators OR, AND and NOT; in C and some languages inspired by it, these are represented by "||" (double pipe character), "&&" (double ampersand) and "!" (exclamation point) respectively, while the corresponding bitwise operations are represented by "|", "&" and "~" (tilde). In the mathematical literature the symbols used are often "+" (plus), "·" (dot) and overbar, or "∨" (vel), "∧" (et) and "¬" (not) or "′" (prime). Some languages, e.g., Perl and Ruby, have two sets of Boolean operators, with identical functions but different precedence. Typically these languages use and, or and not for the lower precedence operators. Some programming languages derived from PL/I have a bit string type and use BIT(1) rather than a separate Boolean type. In those languages the same operators serve for Boolean operations and bitwise operations. The languages represent OR, AND, NOT and EXCLUSIVE OR by "|", "&", "¬" (infix) and "¬" (prefix). ===Short-circuit operators=== Some programming languages, e.g., Ada, have short-circuit Boolean operators. These operators use a lazy evaluation, that is, if the value of the expression can be determined from the left hand Boolean expression then they do not evaluate the right hand Boolean expression. As a result, there may be side effects that only occur for one value of the left hand operand. ==Examples== The expression is evaluated as . The expression is evaluated as . and are equivalent Boolean expressions, both of which are evaluated as . Of course, most Boolean expressions will contain at least one variable ( ), and often more ( ). ==See also== Expression (computer science) Expression (mathematics) Boolean function ==References== ==External links== The Calculus of Logic, by George Boole, Cambridge and Dublin Mathematical Journal Vol. III (1848), pp. 183–98.

References

No reference rows published for this article.

Cite this article

MLA

"Boolean expression." encyclopegia.org, 2026, https://encyclopegia.org/wiki/boolean-expression. Accessed 24 November 2026.

Chicago

"Boolean expression." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/boolean-expression.

APA

encyclopegia.org. (2026). Boolean expression. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/boolean-expression

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Appleton, Warrington

enwiki · references available

Saifuddin Kitchlew

enwiki · references available

2003 Melbourne Cup

enwiki · references available

2002 Melbourne Cup

enwiki · references available

Padmarao Nagar

enwiki · references available

Battle of Juncal

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1359103794 · 0.5 · snapshot enwiki-001359103794

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.