iOS 12 Programming for Beginners
上QQ阅读APP看书,第一时间看更新

Booleans

Booleans (bools) are referred to as logical because they can either be true or false. Use Booleans when you need to determine whether some logic is true or false. For example, did the user log in? This statement would either be true—yes they did, or false—no they did not. So, in Playgrounds, add true and false:

Now, we have covered all of the primary data types in Swift. Right now, we have no way to use these data types. Using the data is where variables and constants come into play.