LOTUSSCRIPT 言語


And 演算子
2 つの式の論理積を求めます。And 演算の実行前に、最も近い整数に丸められます。

構文

expr1 And expr2

要素

expr1expr2


使用法

And 演算子では、FALSE 式の結果はすべて FALSE になります。
expr1expr2結果
TRUETRUETRUE
TRUEFALSEFALSE
FALSETRUEFALSE
FALSEFALSEFALSE
TRUENULLNULL
NULLTRUENULL
FALSENULLFALSE
NULLFALSEFALSE
NULLNULLNULL
論理積の演算に加え、And 演算子は 2 つの数式の同一位置にあるビットを比較し (ビット位置比較)、結果の対応するビットを設定します。
expr1 のビット nexpr2 のビット n結果のビット n
11 1
1 0 0
0 1 0
0 0 0

' Boolean usage

Dim johnIsHere As Boolean, jimIsHere As Boolean

Dim bothAreHere As Boolean

johnIsHere = TRUE

jimIsHere = FALSE

bothAreHere = johnIsHere And jimIsHere

Print bothAreHere                 ' Prints 0 (False)

' Bit-wise usage
Dim x As Integer, y As Integer
x% = &b11110000
y% = &b11001100
Print Bin$(x% And y%)              ' Prints 11000000

関連項目