AND operator (bitwise)

Performs a bitwise AND operation on two expressions of the same flag enum type and returns a new instance of the same type.

Syntax

flag-enum-expression AND flag-enum-expression
flag-enum-expression
An expression whose value is a flag enum instance. Both expressions must be the same flag enum type, and neither expression can be the Unknown value (?).

Example

You can use bitwise AND to check to see if a particular flag or flags is set. This code fragment defines a variable of type Progress.Reflect.Flags (see the Progress.Reflect.Flags enumeration entry for a full list of members) and uses AND to check to see if the Public flag is set.

DEFINE VARIABLE flagsEnum AS Progress.Reflect.Flags.

flagsEnum = Flags:Public OR Flags:Private.
 
IF (flagsEnum AND Flags:Public) EQ Flags:Public THEN...

The bitwise AND operation results in an enum instance in which the only flags set are the flags set in both expressions. In this case, the resulting instance has the Public flag set.

You can also use Progress.Lang.FlagsEnum's IsFlagSet( ) method to achieve the same result:

IF flagsEnum:IsFlagSet(Flags:Public) THEN...

Notes

See also

ENUM statement, IsFlagSet( ) method, NOT operator (bitwise), XOR operator (bitwise), OR operator (bitwise)