A boolean is a term used to represent either a state of true
or false
.
When it comes to programming, most languages for example, Python use the true
and false
construct for booleans:
01: b = True
02: type(b)
03: <class 'bool'>
For other languages or under certain conditions a 1
for True and a 0
for False can be used instead.
These states can then later be used in a conditional [→] to decide the direction a code execution flow should take.
01:
02: var a = true
03:
04: if(a) {
05: console.log("a is true")
06: } else {
07: console.log("a is not true")
08: }
Here is another article you might like 😊 What Is An Integer In Programming?