VB.Net Syntax


And



If (oMyObject Is Nothing) And (bUpdate = False) Then
End If

AndAlso

Performs short-circuiting logical.
A logical operation is said to be short-circuiting if the compiled code can bypass the evaluation of one expression depending on the result of another expression.
This means if the first expression is False the expression returns False and does not evaluated the second expression.


If (oMyObject Is Nothing) AndAlso (oMyObject.Property = True) Then 
End If

ExpressionReturnedNotes
True AndAlso TrueTrue 
True AndAlso FalseFalse 
False AndAlso TrueFalseTrue is not evaluated
False AndAlso FalseFalseFalse is not evaluated
Not (True AndAlso True)False 
Not (True AndAlso False)True 
Not (False AndAlso True)True 
Not (False AndAlso False)True 

Or


If (oMyObject Is Nothing) Or (sFullName = "Steven") Then 
End If


OrElse

Performs short-circuiting inclusive logical.
A logical operation is said to be short-circuiting if the compiled code can bypass the evaluation of one expression depending on the result of another expression.
This means if the first expression is True the expression returns False and does not evaluated the second expression.


If (oMyObject Is Nothing) OrElse (sFullName = "Steven") Then 
End If

ExpressionReturnedNotes
True OrElse TrueTrueTrue is not evaluated
True OrElse FalseTrueFalse is not evaluated
False OrElse TrueTrue 
False OrElse FalseFalse 
Not (True OrElse True)False 
Not (True OrElse False)False 
Not (False OrElse True)False 
Not (False OrElse False)True 

Xor

Performs short-circuiting inclusive logical.
A logical operation is said to be short-circuiting if the compiled code can bypass the evaluation of one expression depending on the result of another expression.
This means


If (oMyObject Is Nothing) Xor (sFullName = "Steven") Then 
End If

ExpressionReturnedNotes
True Xor TrueTrue 
True Xor False  
False Xor True  
False Xor False  
Not (True Xor True)  
Not (True Xor False)  
Not (False Xor True)  
Not (False Xor False)  


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext