Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
42 lines (32 loc) · 919 Bytes

File metadata and controls

42 lines (32 loc) · 919 Bytes
Copy raw file
Download raw file
Outline
Edit and raw actions

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)

Morty Proxy This is a proxified and sanitized view of the page, visit original site.