Movatterモバイル変換


[0]ホーム

URL:


  1. Glossary
  2. Boolean

Boolean

In computer science, aBoolean is a logical data type that can have only the valuestrue orfalse.

For example, in JavaScript, Boolean conditionals are often used to decide which sections of code to execute (such as inif statements) or repeat (such as infor loops).

Below is some JavaScript pseudocode (it's not truly executable code) demonstrating this concept.

js
/* JavaScript if statement */if (boolean conditional) {  // code to execute if the conditional is true}if (boolean conditional) {  console.log("boolean conditional resolved to true");} else {  console.log("boolean conditional resolved to false");}/* JavaScript for loop */for (control variable; boolean conditional; counter) {  // code to execute repeatedly if the conditional is true}

The Boolean value is named after English mathematicianGeorge Boole, who pioneered the field of mathematical logic.

Above is a general introduction. The termBoolean can have more specific meanings depending on the context. It may refer to:

Boolean (JavaScript)
ABoolean in JavaScript is a primitive value that can be eithertrue orfalse.
Boolean attribute (ARIA)
Aboolean attribute in ARIA is an enumerated attribute that includestrue orfalse in the enumerated list.
Boolean attribute (HTML)
Aboolean attribute in HTML is an attribute that representstrue orfalse values. If an HTML tag contains a boolean attribute — no matter the value of that attribute — the attribute is set totrue on that element. If an HTML tag does not contain the attribute, the attribute is set tofalse.

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp