Swift Basics

Booleans

Booleans or Boolean values represent the logical ideas of true and false.

Booleans only have two values: true and false. The term boolean is based on the name of the inventor of logic, George Boole.

We use booleans to determine the validity and to make decisions. You can think of booleans in a myriad of ways, like on and off, yes and no, sometimes even 1 and 0.

It’s important to remember that the words true and false we use to represent boolean values are different from the strings “true” and “false”.

   
« Previous: Doubles Next: Operators »