Facebook Pixel

Why do booleans only hold true or false?

Booleans represent binary logic (1 or 0). They are the foundation of decision-making in programming (if/else conditions).

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Data Types: Primitives vs Non-Primitives

A primitive data type is a basic, built-in type that holds a single, simple value, like an integer, character, or boolean.

In most languages (like Java and C++), Strings are non-primitive reference types because they are arrays of characters. In JS, they behave like primitives.

An integer stores whole numbers without a fractional component. A float (floating-point) stores numbers with decimal points.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.