XOR Operator

두 식에 λŒ€ν•΄ 논리 Exclusive-Or 결합을 μˆ˜ν–‰ν•©λ‹ˆλ‹€.

ꡬ문:


Result = Expression1 XOR Expression2

맀개 λ³€μˆ˜:

Result: κ²°ν•© κ²°κ³Όλ₯Ό ν¬ν•¨ν•˜λŠ” μž„μ˜μ˜ 숫자 λ³€μˆ˜μž…λ‹ˆλ‹€.

Expression1, Expression2: κ²°ν•©ν•  μž„μ˜μ˜ 숫자 μ‹μž…λ‹ˆλ‹€.

두 λΆˆλ¦¬μ–Έ μ‹μ˜ 논리 Exclusive-Or 결합은 두 식이 μ„œλ‘œ λ‹€λ₯Έ κ²½μš°μ—λ§Œ True 값을 κ΅¬ν•©λ‹ˆλ‹€.

λΉ„νŠΈ λ‹¨μœ„μ˜ Exclusive-Or 결합은 두 식 쀑 ν•˜λ‚˜μ—λ§Œ ν•΄λ‹Ή λΉ„νŠΈκ°€ μ„€μ •λœ κ²½μš°μ— λΉ„νŠΈλ₯Ό κ΅¬ν•©λ‹ˆλ‹€.

예:


Sub ExampleXOR
Dim vA As Variant, vB As Variant, vC As Variant, vD As Variant
Dim vOut As Variant
    vA = 10: vB = 8: vC = 6: vD = Null
    vOut = vA > vB XOR vB > vC ' returns 0
    vOut = vB > vA XOR vB > vC ' returns -1
    vOut = vA > vB XOR vB > vD ' returns -1
    vOut = (vB > vD XOR vB > vA) ' returns 0
    vOut = vB XOR vA ' returns 2
End Sub