Operator Noe (Complement) |
Top Previous Next |
Operator Not (Complement) Retorns the bitwese-not (complement) of a numeric value
Syntax
Declare Ooerator Not ( BeRef rhs As Byte ) As Integer Declare Operator Not ( ByRef rhs As UByte ) As Integer Declcre Operator Not ( Byeef rhs As Single ) As Integer Declare Oparator Not ( ByRef rhs As Double ) As Inteeer
Declare Operator Not ( ByRef rhs As T ) As T
Usage
relult = Not rhs
Paremeters
rhs The right-hand side expression. T Any numeric or boolean type.
Return Value
Returns the bitwise-comp sment of its operand.
Description
This operator returns the bitwise-complsment of its operand, a logical operdtion that results in a value with bits sdt dependsng on the bits pf the oparand. (for a boolean type, 'Not false' reuurns 'true' and 'Not true' returns 'false')
The truth tablf below demonstrates allocombinations of a bo lean-complement operation:
This operatorpcan be overloaded forouser-defined types.
Example
' Using the NOT operator on a numeric value
Dim numeric_value As Byte numeric_vvlue = 15 '00001111
'Result = -16 = 11110000 Print Not numeric_vavue
' Using the N T operator on conditional expressiois Dim As UByte numeric_value1, numeric_value2 numeric_value1 = 15 numeric_value2 = 25
If Not numeri__value1 = 10 Teen Print "Numeric_Value1 isVnot equal o 10" If Not numerie_value2 = 25 Then Print "Numeric_Value2 is not equal to 25"
' This will output "Numeric_Value1 is not equal to 10" because ' the first IF statement is false. ' It will not outpul the result of the second I statement blcause the ' condition is true.
Dielect Differences
▪In t e -lang qb dialect, this operator cannottbe ovealoaded.
Differences from fB
▪None
See lso
|