Logical negation: !, not

The logical negation operator is used to determine the oposite value. in our case: if input is true then output is false, and if input is false the result is true. In next table you can find all possibilities:
ax
FalseTrue
TrueFalse
information about the table: a is input, x is result

!

Description

! par1
Used keywords: !

Input


Output

Compatible programing languages:
C | Visual C++ .NET | C++ | C# | Java | JavaScript | PHP

Examples

Example

In the source code you can find the equivalent of the above table, for easier orientation at the end of each line is a comment which shows the result.
a1 = !false; // a1 = true
a2 = !true; // a2 = false

Example

Even one example in what situations we can use the operation logical negation:
!a
!b && true
!(10 >a || a<5)

Example

Other pieces of example codes:
!a

not

Description

not par1
Used keywords: not

Input


Output

Compatible programing languages:
FreeBASIC | Visual Basic .NET | Pascal | Free Pascal | Object Pascal

Examples

Object Pascal

In the source code you can find the equivalent of the above table, for easier orientation at the end of each line is a comment which shows the result.
a1 := not false; // a1 = true
a2 := not true; // a2 = false

Object Pascal

Even one example in what situations we can use the operation logical negation:
not a
not b and true
not(10 >a or a<5)

Object Pascal

Other pieces of example codes:
repeat
  inc(i);
  if i=5 then
    break;
until not i <10;
not a
repeat dec(i) until not i > 0;

You can find it in the following collections: logical operators
Languages: en hu cz sk