Comp 101 Boolean

Boolean

What is it?

Boolean is a representation of something's truth value, being either true or false.

Fun fact: Boolean logic is named for English mathematician George Boole!

How do we use boolean as a data type in TypeScript?

We use the boolean keyword to tell our program the type of variable we're creating. Or, we can just let the program assume the boolean type for us.

let myHeartIs = true;
let myHeartIsAlways: boolean = true; // Either is fine.