← All examples

True and false

not, and, and comparing a bool.

bools.zg
# True and false: `not`, `and`, and comparing a bool.
MAIN {
    let 'correct?': bool = true;
    let 'wrong?' := not 'correct?';
    if 'correct?' and (not 'wrong?') {
        std::print.stored["fine", newln];
    }
    if 'wrong?' equal_to false {
        std::print.stored['correct?', " ", 'wrong?', newln];
    }
}
Output
fine
true false