Hello and welcome to the eighth lesson in Swift programming brought to you by MadApper. My name is Paul Napier, and in this lesson we are going to cover another of the basic variable types: Booleans.
Booleans are possibly the simplest features of any programming language. They are simple true or false objects, so I might say that grass is green, which is a true statement or if I said that the sea is orange, then this is a false statement.
In Objective C, you declare a Boolean as below:
bool myBoolean = true<\pre>
You can substitute the word true for YES or even 1 and when it is false, you can substitute the word false for NO or even 0. In Swift, however, you can only determine a Boolean with either true or false. i.e.
var boolean:Bool = true
You will find that booleans are most useful when you come to comparisons in your code, where you need to define if one statement is true such as snow is white or up is down. And we will touch more upon booleans when we come to if statements further in the course.
In the next session we are going to start looking at the characters and at the concept of characters.