Booleans in Swift
By Flavio Copes
An introduction to booleans in Swift using the Bool type, which holds true or false and powers conditionals like if statements and the ternary operator.
~~~
This tutorial belongs to the Swift series
Swift provides the Bool type, which can have two values: true and false.
var done = false
done = true
Booleans are especially useful with conditional control structures like if statements or the ternary conditional operator:
var done = true
if done == true {
//code
}~~~
Related posts about swift: