Dictionary entry

bool

nouncomputing

Last updated

UK/buːl/
US/buːl/

Meanings

  1. nouncountablecomputing

    In programming, a value or variable that can be only true or false.

    Grammar: Countable: a bool, two bools; often written as a type name in code, e.g. bool flag.

    Patterns

    • a bool variable
    • set something to a bool
    • return a bool

    The function returns a bool: true if the file exists, false if it does not.

    Declare the flag as a bool so it can only be true or false.

    Beginners often forget that a bool cannot hold a number or a word.

  2. noununcountablecomputing

    A data type in a programming language whose values are true and false.

    Grammar: Uncountable when naming the type itself: convert the text to bool.

    Patterns

    • convert something to bool
    • store something as bool

    In Python, bool is a built-in type, so you do not need to import it.

    The compiler treats the result as bool, not as an integer.

Word forms

pluralbools

Common combinations

a bool value
Each setting is stored as a bool value, either true or false.
return a bool
Write a helper method that returns a bool.
convert to bool
The parser will convert the input to bool before comparing.
bool variable
Name the bool variable isReady so the code reads clearly.

Synonyms and how they differ

Boolean
The standard adjective and noun form; use Boolean in formal writing and bool mainly in code or technical talk.
flag
A flag is a variable that marks whether something is on or off; it is usually a bool but the word describes its job, not its type.

Word family

Boolean adjective
Relating to true-or-false logic, as in Boolean algebra or a Boolean search.

Commonly confused: bool or boolean? bool or boule?

bool vs boolean

Same idea, different spelling and use: Boolean is the normal word in English text, while bool is the short form used inside programming languages.

bool vs boule

Sounds similar but means a ball, especially in the French game of boules, or a shape of cut gem.

Practice

Which sentence uses "bool" correctly?

Make it your own

Write a sentence using “bool”, then check it and compare it with the examples above.

Your sentence stays on this page and is not sent anywhere.

Explore more words