# Double negation operator (--)

**--**Value

## Value — Number, Logical, { Number } or { Logical }

The value to convert.

## Returns — Number or { Number }

0 if the given operand is FALSE, 1 if it is TRUE and the unchanged operand if it is a number.

Returns 0 if the given operand is FALSE, 1 if it is TRUE and the operand unchanged if is a number. --FALSE--FALSE returns 0 and --TRUE--TRUE returns 1.

This operator is typically used to convert an array of logical values to an array of numbers. This formula returns the array { 1, 0, 0 }{ 1; 0; 0 }:

This is useful in a variety of situations—refer to the examples below.

The TONUMBER function is similar, but can also convert text strings.

## Examples

Returns 0.

Returns the array { 0, 1 }{ 0; 1 }.

Returns the number of switch fields that are toggled to their "on"
positions. If the { SwitchField1:SwitchField5 }{ SwitchField1:SwitchField5 }
array equals { FALSE,
TRUE, FALSE, TRUE, FALSE }{ FALSE; TRUE; FALSE; TRUE;
FALSE }, the `--`

operator turns it into
{ 0, 1, 0, 1,
0 }{ 0; 1; 0;
1; 0 }. Finally, the SUM function adds the array elements
together, yielding 2, which is the number of switch fields toggled to
their "on" positions.

Returns the number of switch fields that are toggled to their "on" positions. The TONUMBER formula function can also be used to convert logical values to numbers, but also supports text strings.

Returns the number of array members which are greater than 3. (In this
case, only 4 and 5 are greater than 3, meaning that 2 is returned.) When
applied to { 1, 2, 3, 4,
5 }{ 1; 2; 3;
4; 5 } and 33, > returns a logical array with
the same number of elements as the { 1, 2, 3, 4,
5 }{ 1; 2; 3;
4; 5 } number array, where individual logical values indicate
if the corresponding number in the number array is greater than 3. In
other words, { 1, 2, 3, 4,
5 } > 3{ 1; 2; 3; 4; 5 } >
3 returns { FALSE,
FALSE, FALSE, TRUE, TRUE }{ FALSE; FALSE; FALSE; TRUE;
TRUE }, which the `--`

operator turns into
{ 0, 0, 0, 1,
1 }{ 0; 0; 0;
1; 1 }. Finally, the SUM functions adds together all elements,
yielding 2.

Returns the number of array elements which are odd. The ISODD function returns
the logical array { TRUE,
FALSE, TRUE, FALSE, TRUE }{ TRUE; FALSE; TRUE; FALSE;
TRUE }, indicating that 11, 33 and 55 are odd, whereas 22 and 44 are even. The `--`

operator then turns that logical array into the number array { 1, 0, 1, 0,
1 }{ 1; 0; 1;
0; 1 }. When given that array, the SUM function returns 3, indicating that
three of the array elements are odd.

Returns the number of array elements which are odd or are greater than 1.
All array elements qualify, meaning that 3 is returned. ISODD({ 1, 2,
3 })ISODD({ 1; 2;
3 }) returns the logical array { TRUE, FALSE,
TRUE }{ TRUE;
FALSE; TRUE }, because only 1 and 3 are odd numbers.
{ 1, 2, 3 } >
1{ 1; 2; 3 }
> 1 returns the logical
array { FALSE, TRUE,
TRUE }{ FALSE;
TRUE; TRUE }, as the array elements 2 and 3 are greater than
1. The addition operator in ISODD({ 1, 2, 3 }) + ({ 1,
2, 3 } > 1)ISODD({ 1; 2; 3 }) + ({ 1;
2; 3 } > 1) acts as a
**logical or** operator, meaning that the resulting logical
array { TRUE, TRUE,
TRUE }{ TRUE;
TRUE; TRUE } is filled with TRUE values, because every
element of the array { 1,
2, 3 }{ 1; 2;
3 } is either odd, or is greater than 1. When given that
array, the SUM
function returns 3, indicating that three of the array elements are
either odd or are greater than 1.

Returns the number of array elements which are odd or are greater than 1. All array elements qualify, meaning that 3 is returned. This formula uses the || operator instead of the + operator, with identical results.

Returns the number of array elements which are both odd and are greater
than 1. Only the array element 3 qualifies, meaning that 1 is returned.
ISODD({ 1, 2,
3 })ISODD({ 1; 2;
3 }) returns the logical array { TRUE, FALSE,
TRUE }{ TRUE;
FALSE; TRUE }, because only 1 and 3 are odd numbers.
{ 1, 2, 3 } >
1{ 1; 2; 3 }
> 1 returns the logical
array { FALSE, TRUE,
TRUE }{ FALSE;
TRUE; TRUE }, as the array elements 2 and 3 are greater than
1. The multiplication operator in ISODD({ 1, 2, 3 }) *
({ 1, 2, 3 } > 1)ISODD({ 1; 2; 3 }) *
({ 1; 2; 3 } > 1) acts as a
**logical and** operator, meaning that the resulting logical
array { FALSE, FALSE,
TRUE }{ FALSE;
FALSE; TRUE } is FALSE for the first element 1 (as it isn't
greater than 1), is FALSE for the second element 2 (as it isn't odd) and
is TRUE for the third element 3 (as it is both greater than 1 and is
odd). When given that array, the SUM function returns 1, indicating that
one element of the original array is both odd and is greater than 1.