| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== BXOR (return bitwise exclusive OR) ====== | [[build build keys and indexes .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[bytes return size in bytes .htm|{{btn_next_n.gif|Next page}}]] | | || **BXOR(**//value//,//mask//**)** {{blk2blue.jpg|blk2blue.jpg}} | **BXOR** | Performs bitwise exclusive OR operation. | | //value// | A numeric constant, variable, or expression for the bit //value// to be compared to the bit //mask//. The //value// is converted to a LONG data type prior to the operation, if necessary. | | //mask// | A numeric constant, variable, or expression for the bit //mask//. The //mask// is converted to a LONG data type prior to the operation, if necessary. | The **BXOR** procedure compares the //value// to the //mask//, performing a Boolean XOR operation on each bit. The return value is a LONG integer with a one (1) in the bit positions where either the //value// or the //mask// contain a one (1), but not both. Zeroes are returned in all bit positions where the bits in the //value// and //mask// are alike. BXOR is usually used to toggle on (1) or off (0) an individual bit, or multiple bits, within a variable. | **Return Data Type:** | LONG | **Example:** **!BXOR(0110b,0010b) returns 0100b  !0110b = 6, 0100b = 4, 0010b = 2** **RateType  BYTE            !Type of rate** **Female    EQUATE(0001b)   !Female mask** **Male      EQUATE(0010b)   !Male mask** **Over25    EQUATE(0100b)   !Over age 25 mask** **Over65    EQUATE(1100b)   !Over age 65 mask** ** CODE** ** RateType = ****BXOR****(RateType,Over65)  !Toggle over 65 bits** **See Also:** [[band return bitwise and .htm|BAND]] [[bor return bitwise or .htm|BOR]] [[bshift return shifted bits .htm|BSHIFT]]