Tsallaka zuwa abun ciki
Justice Tech School

Swift Booleans

Bool is true or false. Comparisons give booleans, and ! flips them. toggle() flips a variable in place.

Example
var on = true
print(on, !on, 5 > 3)
on.toggle()
print(on)

Exercise

Flip a Bool.

on.()

Quiz Test

Which operator is logical not?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.