Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Visual Basic .NET/Logical operators

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Logical Operators Not The Not operator returns True when the condition is False. Otherwise, it returns False. Example, If Not (1 = 2) Then MessageBox.Show("(1 = 2) is False. So Not False is True") End If +Truth Table Condition Not Condition True False False True And The And operator returns True when the conditions of the left and right are True. Otherwise, it returns False. Both conditions are evaluated before the result is returned. Example, If (1 = 1) And (2 = 2) Then MessageBox.Show("(1 = 1) is True. (2 = 2) is True. So True And True is True") End If +Truth Table Condition1 Condition2 Condition1 And Condition2 True True True True False False False True False False False False AndAlso The AndAlso operator returns False when the condition on the left hand side is False. Else, it returns True when the conditions of the left and right are True. Otherwise, it returns False. The condition on the right hand side is never evaluated when that on the left hand side is False. This is called short-circuited logic. +Truth Table Condition1 Condition2 Condition1 AndAlso Condition2 True True True True False False False - False Or The Or operator returns True when the condition on either side is True. Otherwise, it returns False. Both conditions are evaluated before the result is returned. +Truth Table Condition1 Condition2 Condition1 Or Condition2 True True True True False True False True True False False False OrElse The OrElse operator returns True when the condition on the left hand side is True. Else, if the condition on the right hand side is True, it returns True. Otherwise, it returns False. The condition on the right hand side is never evaluated when that on the left hand side is True. This is called short-circuited logic. +Truth Table Condition1 Condition2 Condition1 OrElse Condition2 True - True False True True False False False Xor The Xor operator returns True when the condition on the left hand side or right hand side is True, but not when both are True. Xor means "Exclusive OR". +Truth Table Condition1 Condition2 Condition1 Xor Condition2 True True False True False True False True True False False False fr:Visual Basic .NET/Logique