Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 919 Bytes

boolean.md

File metadata and controls

42 lines (32 loc) · 919 Bytes

Boolean

Something that is only true or false.

A boolean has one of two possible values: true or false. The boolean (logical) operators (and, or, not) take boolean inputs and make another boolean value. Comparing on other types (numbers, strings) with logical operators create boolean values.

These blocks represent the true and false boolean values, which can be plugged in anywhere a boolean value is expected:

let on = true;
let off = false;
off = false;

You can set and compare other boolean values:

let on = true;
let off = !on;
let switcher = on;
let lights = off;

if (switcher) {
    lights = on;
} else {
    lights = off;
}

Compare other types:

let cool = 50;
let temp = 65;
let warming = temp > cool;

if (warming) {
    let message = "It's warming up."
}

See Also

boolean (blocks)