What is Bool

suggest change

Bool is a Boolean type with two possible values: true and false.

let aTrueBool = true
let aFalseBool = false

Bools are used in control-flow statements as conditions. The if statement uses a Boolean condition to determine which block of code to run:

func test(_ someBoolean: Bool) {
    if someBoolean {
        print("IT'S TRUE!")
    }
    else {
        print("IT'S FALSE!")
    }
}
test(aTrueBool)  // prints "IT'S TRUE!"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents