Revision [15723]

This is an old revision of KeyPgOpAndAlso made by CountingPine on 2012-01-17 11:56:05.

 

Operator ANDALSO (Short Circuit Conjunction)


Returns the short circuit-and (conjunction) of two numeric values

Syntax:
Usage:
result = lhs AndAlso rhs

Parameters:
lhs
The left-hand side expression.
T1
Any numeric type.
rhs
The right-hand side expression.
T2
Any numeric type.
Ret
An Integer.

Return Value:
Returns the short circuit-and (conjunction) of the two operands.

Description:
This operator evaluates the left hand side expression. If the result is zero, then zero is immediately returned. If the result is non zero then the right hand side is evaluated, and the logical result from that is returned.
The truth table below demonstrates all combinations of a short circuit-and operation, the '-' denotes that the operand is not evaluated.
Lhs Value Rhs Value Result
0 - 0
1 0 0
1 1 1

Short-circuiting is performed - only expressions needed to calculate the result are evaluated.

The return type is always an Integer, of the value 0 or -1, denoting false and true respectively.
This operator cannot be overloaded for user-defined types.

Examples:
' Using the ANDALSO operator on two numeric values
Dim As Integer numeric_value1, numeric_value2
numeric_value1 = 15
numeric_value2 = 30

'Result =  -1
Print numeric_value1 ANDALSO numeric_value2
Sleep


Differences from QB:
See also:
Back to Short Circuit Operators
Back to Operators
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode