Preface to the logical relationship in VB not and OR Xor Eqv Imp Small note
Preface
Knocking on the computer room encountered a problem, that is, the logical relationship in the combinatorial query is in accordance with what order to run. Do you follow the order of your own knocking? For example, when propelled together, is it in the order of the first line, the second row, and the third line? And then look at my solution. logical Relationship in VB
First of all, the order of these logical relationships, the logical operators, like subtraction in mathematics, always have a sequential
Not
and
Or
Xor
Eqv
Imp
Give me a chestnut:
This query statement is the first "and" relationship, then "or" relationship, so there will be such a query result
not
Logical non, denoted by a symbol as ". ”
Not is the highest priority in logical operators, so look underneath the chestnuts
Dim B as Boolean = False and not True
First does not true returns False, then the original statement is equivalent to false and false, so the final result B is false and
Logic and, interpretation is the equivalent of life said "and". && is called logic, and only two operands are true, and the result is true. && is known as brevity and or short-circuiting, and only two operands are true, and the result is true. OR
Logical OR, denoted by a symbol as "| |"
True if any of the operators are true, otherwise false Xor
Exclusive OR, or abbreviated to an XOR symbol, is indicated as: ⊙
Formula: Same take 0, different take 1
In fact, XOR is defined in English as either one (IS-one), but not both, that is, only a true (1), takes true (1).
True XOR true = False
True XOR False =true
False XOR True =true
False xor false =false Eqv
Eqv meaning for equivalent use, EQV and XOR are the opposite
In Eqv
True Eqv true = True
True Eqv false =false
False Eqv True =false
False Eqv false =true
That is, if the logical value of two variables is the same, true, the difference is false Imp
Contains IMP
Result=expression1 IMP expression2
True True True
True false False
False true True
False False True
The result is false if the first expression is expression1 true and the second expression is expreesion2 false, and the result is true in other cases.
If ..., then ... "(If...then ...)". ), denoted by a symbol →. Set P,q to express two propositions
If p means "I have a car" and Q says "I'm going to pick you up", then P→q says, "If I have a car, I'll pick you up." When I have a car, if I go to pick you up, then the promise p→q true, if I did not meet you, then the Promise p→q false. When I do not have a car, whether I go or not to meet you have not broken my word, at this time to determine p→q is really appropriate. Xiao Kee
When I understand these and then take their own combination of content to practice, I feel very strong sense of logic, or some of the content is not easy to understand, so understand after still understand a lot, but also understand the connotation, let oneself more understand, it seems that later in the end is very important, Not will be found the source of power, refueling.