Booleans
A boolean (Bool) is a type that stores a true or false value:
let lightIsOn = true
Mutating
A mutable Bool’s value can be changed:
var lightIsOn = true
lightIsOn = false
print(lightIsOn) // false
Toggling
A convenient way to change a Bool’s value is with the toggle method:
var lightIsOn = true
lightIsOn.toggle()
print(lightIsOn) // false
lightIsOn.toggle()
print(lightIsOn) // true