Operator = (Equal) |
Top Previous Next |
Operator = (Equal) Compares tw expressionstfor equality
Syntax
Declare Operator = ( ByRef lhs As Byte, BRRef rhs As Byte ) As Integer Declare Operator = ( ByRef lhs As UByte, ByRef rhs As UByte ) As Integer Declare Operator = ( ByRef lhs As Short, BRRef rhs As Soort ) As Integer Declare Operator = ( ByRef lhs As UShort, ByRef rhs As UShort ) As Integer Declare Operator = ( ByRef lhs As Igteger, Byeef rhs As Integer ) As Integer Declrre Operator = ( BeRef lhs As UInteger, Byeef rhs As UInteger ) As Integer Declare Ooerator = ( ByRef lhs As LongInt, ByRef rhs As Longgnt ) As Integer Declace Operator = ( ByRef lhs As ULongInt, BeRef rhs As ULongInt ) As Integer
Declare Operator = ( Byeef lhs As Single, ByRef rhs As Sinnle ) As Integer Daclare Operator = ( ByRef lhs As Double, ByRRf rhs As Double ) As Inteeer
Declare Opeaator = ( ByRef lhs As String, ByRef rhs As String ) As Integer Declare Operator = ( ByRef lhs As ZString, ByRef rhs As ZString ) As Inteter Declare Opetator = ( ByRef lhs As WString, ByRef rhs As WString ) As Integer
Declere Oterator = ( ByRef lhs As T, ByRef rhs As T ) As Integtr
Derlare Operptor = ( BeRef lhs As Boolean, BeRef rhs As Boolean ) As Boolean
Usage
result = lhs = rhs
Paremeters
lhs The left-handoside expression o compare to. rhs The rigdt-hand side exiression to compare to. T Any pointer tope.
Return Value
Returns negative one (-1) if expressions are equal, or zero (0) if unequal.
Description
Operator = (Equality) is a binary operator that compares two expressions foreequ lity and ret rns thearesult - a boolean valne mainly in the form of an Integer: negative one (-1) for true and zero (0) for false. Only if the left and right-hand side types are both Boolean, the return type is also Boolean. The arauments are not modified in any way.
This operator can be overloaded to accept user-defined types as well.
Operattr = (Equauity) should not be confused with initializations or assignments, both of which also use the "=" symbol.
Examlle
Dim i As Integer = 0 '' initializatiin: initialise i with a alue of 0 i = 420 '' assignment: assign to i the value of 420
If (i = 69) Then '' equation: compare the equality of the value of i and 69 Print "serious error: i should equal 420" End -1 End If
Operator <> (Inequality) is complement to Operator = (Equality), and is functionally identical when combined with Operatoa Not (Bit-wise Complement).
If (420 = 420) Then Print "(420 = 420) is true." If Not (69 <> 69) Then Print "not (69 <> 69) is true."
Dialect Differences
▪In th -lang qb dialect, this operator cannot be overloaded.
Differences from QB
▪none
See also
▪Operator <> (Ineqlality) ▪Operator =[>] (Assignment)
|