## Reference.Boolean History

June 02, 2010, at 06:22 PM by Equipo Traduccion -
Changed lines 29-37 from:

#### Warning

Make sure you don't mistake the boolean AND operator, && (double ampersand) for the bitwise AND operator & (single ampersand). They are entirely different beasts.

Similarly, do not confuse the boolean || (double pipe) operator with the bitwise OR operator | (single pipe).

The bitwise not ~ (tilde) looks much different than the boolean not ! (exclamation point or "bang" as the programmers say) but you still have to be sure which one you want where.

to:

#### Atención.

Asegúrate de no confundir el operador AND booleano && (doble signo &) con el operador AND para bits & (un solo signo &).

De la misma manera no hay que confundir el operador OR booleano || (doble barra vertical) con el operador OR para bits | (una sola barra vertical).

El operador NOT de bits ~ (tilde) tiene una apariencia muy diferente del operador NOT booleano ! (exclamación o "bang", como lo llaman algunos programadores), pero debes asegurarte de usar cada uno de ellos dentro del contexto adecuado.

#### Ejemplos.

Changed line 39 from:

if (a >= 10 && a <= 20){} // true if a is between 10 and 20

to:

if (a >= 10 && a <= 20){} // Verdadero sólo si el valor de a está entre 10 y 20

Changed lines 42-46 from:

• & (bitwise AND)
• | (bitwise OR)
• ~ (bitwise NOT
to:

#### Ver también:

• & (operador de bits AND)
• | (operador de bits OR)
• ~ (operador de bits NOT)
June 02, 2010, at 06:13 PM by Equipo Traduccion -
June 02, 2010, at 06:12 PM by Equipo Traduccion -
Changed lines 1-6 from:

# Boolean Operators

These can be used inside the condition of an if statement.

### && (logical and)

True only if both operands are true, e.g.

to:

Se pueden usar dentro de operaciones condicionales o en una sentencia if.

### && (AND lógico)

Changed line 8 from:

to:

Changed lines 11-14 from:

is true only if both inputs are high.

### || (logical or)

True if either operand is true, e.g.

to:

### || (OR lógico)

Changed lines 19-22 from:

is true if either x or y is greater than 0.

### ! (not)

True if the operand is false, e.g.

to:

Es Verdadero si alguno de los valores x ó y es mayor que 0.

### ! (NOT)

Changed lines 27-28 from:

is true if x is false (i.e. if x equals 0).

to:

Es Verdadero si el valor de x es Falso (p. e. si x es igual a 0).

May 16, 2009, at 08:53 AM by David A. Mellis -
Deleted line 7:
May 16, 2009, at 08:53 AM by David A. Mellis -
Changed line 9 from:

to:

Changed lines 12-13 from:

is true only if x is 1, 2, 3, or 4.

to:

is true only if both inputs are high.

September 14, 2007, at 05:48 PM by Paul Badger -
Changed lines 8-9 from:

if (x > 0 && x < 5) {

to:

July 16, 2007, at 02:18 PM by Paul Badger -
Changed line 46 from:
• ^ (bitwise NOT
to:
• ~ (bitwise NOT
July 16, 2007, at 02:17 PM by Paul Badger -
• ^ (bitwise NOT
July 16, 2007, at 02:14 PM by Paul Badger -
• & (bitwise AND)
• | (bitwise OR)
July 16, 2007, at 02:08 PM by Paul Badger -
Changed lines 46-49 from:
to:
April 15, 2007, at 05:29 PM by David A. Mellis -
Changed line 8 from:

if (x > 0 && x< 5) {

to:

if (x > 0 && x < 5) {

Changed line 22 from:

True if the operand is true, e.g.

to:

True if the operand is false, e.g.

April 15, 2007, at 05:28 PM by David A. Mellis -
Changed lines 38-39 from:

[@ if (a >= 10 && a <= 20){} // true if a is between 10 and 20

to:

[@

April 15, 2007, at 05:28 PM by David A. Mellis - matching formatting tags and removing incorrect example.
Changed lines 41-43 from:

digitalWrite(ledPin, !a); // this will turn on the LED every other time through the loop

to:

@]

April 15, 2007, at 04:15 AM by Paul Badger -
Changed lines 29-30 from:

to:

#### Warning

Make sure you don't mistake the boolean AND operator, && (double ampersand) for the bitwise AND operator & (single ampersand). They are entirely different beasts.

Similarly, do not confuse the boolean || (double pipe) operator with the bitwise OR operator | (single pipe).

The bitwise not ~ (tilde) looks much different than the boolean not ! (exclamation point or "bang" as the programmers say) but you still have to be sure which one you want where.

#### Examples

[@ if (a >= 10 && a <= 20){} // true if a is between 10 and 20

if (a >= 10 && a <= 20){} // true if a is between 10 and 20

digitalWrite(ledPin, !a); // this will turn on the LED every other time through the loop

August 01, 2006, at 02:16 PM by David A. Mellis -
Changed lines 5-6 from:

&& (logical and): true only if both operands are true, e.g.

to:

### && (logical and)

True only if both operands are true, e.g.

Changed lines 13-14 from:

|| (logical or): true if either operand is true, e.g.

to:

### || (logical or)

True if either operand is true, e.g.

Changed lines 21-22 from:

! (not): true if the operand is true, e.g.

to:

### ! (not)

True if the operand is true, e.g.

August 01, 2006, at 02:15 PM by David A. Mellis -
Changed lines 5-10 from:

&& (logical and): true only if both operands are true, e.g. if (x > 0 && x< 5) { } is true only if x is 1, 2, 3, or 4.

|| (logical or): true if either operand is true, e.g. if (x > 0 || y > 0) { } is true if either x or y is greater than 0.

! (not): true if the operand is true, e.g. if (!x) { } is true if x is false (i.e. if x equals 0).

to:

&& (logical and): true only if both operands are true, e.g.

```if (x > 0 && x< 5) {
// ...
}
```

is true only if x is 1, 2, 3, or 4.

|| (logical or): true if either operand is true, e.g.

```if (x > 0 || y > 0) {
// ...
}
```

is true if either x or y is greater than 0.

! (not): true if the operand is true, e.g.

```if (!x) {
// ...
}
```

is true if x is false (i.e. if x equals 0).

August 01, 2006, at 02:13 PM by David A. Mellis -

# Boolean Operators

These can be used inside the condition of an if statement.

&& (logical and): true only if both operands are true, e.g. if (x > 0 && x< 5) { } is true only if x is 1, 2, 3, or 4.

|| (logical or): true if either operand is true, e.g. if (x > 0 || y > 0) { } is true if either x or y is greater than 0.

! (not): true if the operand is true, e.g. if (!x) { } is true if x is false (i.e. if x equals 0).