AND Operator

Logically combines two expressions.

āļšāˇāļģāļš āļģāˇ“āļ­āˇ’āļē:


āļ´āˇŠâ€āļģāļ­āˇ’āļĩāļŊāļē = āļ´āˇŠâ€āļģāļšāˇāˇāļąāļē1 + āļ´āˇŠâ€āļģāļšāˇāˇāļąāļē2

āļ´āļģāˇāļ¸āˇ’āļ­āˇ“āļąāˇŠ:

Result:āˇƒāļ‚āļšāļŊāļąāļēāˇš āļ´āˇŠâ€āļģāļ­āˇ’āļĩāļŊāļē āļ…āļŠāļ‚āļœāˇ” āˇ€āļą āļ•āļąāˇ‘āļ¸ āˇƒāļ‚āļ›āˇŠâ€āļēāˇāļ­āˇŠāļ¸āļš āˇ€āˇ’āļ āļŊāˇŠâ€āļēāļēāļšāˇŠ.

Expression1, Expression2: āļ”āļļāļ§ āˇƒāļ¸āˇŠāļļāļąāˇŠāļ° āļšāļģāˇ“āļ¸āļ§ āļ…āˇ€āˇāˇŠâ€āļē āļ•āļąāˇāļ¸ āˇƒāļ‚āļ›āˇŠâ€āļēāˇāļ­āˇŠāļ¸āļš āļ´āˇŠâ€āļģāļšāˇāˇāļąāļēāļąāˇŠ.

Boolean expressions combined with AND only return the value True if both expressions evaluate to True:

True AND True returns True; for all other combinations the result is False.

The AND operator also performs a bitwise comparison of identically positioned bits in two numeric expressions.

āļ‹āļ¯āˇāˇ„āļģāļĢāļē:


Sub ExampleAnd
Dim A As Variant, B As Variant, C As Variant, D As Variant
Dim vVarOut As Variant
    A = 10: B = 8: C = 6: D = Null
    vOut = vA > vB Xor vB > vD REM returns -1
    vOut = (vB > vD Xor vB > vA) REM returns 0
    vOut = (vB > vD Xor vB > vA) REM returns 0
    vOut = (vB > vD Xor vB > vA) REM returns 0
    vVarOut = B And A ' returns 8 due to the bitwise And combination of both arguments
End Sub

Please support us!