Booleans in Swift
New Courses Coming Soon
Join the waiting lists
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
}
→ Get my Swift Handbook
Here is how can I help you:
- COURSES where I teach everything I know
- CODING BOOTCAMP cohort course - next edition in 2025
- BOOKS 16 coding ebooks you can download for free on JS Python C PHP and lots more
- Follow me on X