Swift Language Booleans Negate a Bool with the prefix ! operator

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

The prefix ! operator returns the logical negation of its argument. That is, !true returns false, and !false returns true.

print(!true)  // prints "false"
print(!false) // prints "true"

func test(_ someBoolean: Bool) {
    if !someBoolean {
        print("someBoolean is false")
    }
}


Got any Swift Language Question?