共用方式為


Boolean (Logical) Operators

Logical operators can only be used with arguments that can be evaluated to Boolean.

Boolean Operators

As the following table shows, the NOT operator is a unary prefix operator. This means that it takes only one argument and is placed in front of the argument. The AND, OR, and XOR operators are binary infix operators; they take two arguments and are placed between the corresponding arguments.

Operator Name Expression Resulting data type

NOT

Logical negation

NOT bool

bool

AND

Logical and

bool AND bool

bool

OR

Logical or

bool OR bool

bool

XOR

Exclusive logical or

bool XOR bool

bool

See Also

Concepts

Type Conversion