This function returns the result of a bitwise `XOR` operation on arguments. There must be at least two arguments. Its syntax is as follows:

`xor(num1, num2, [, ...])`

In the `XOR` operation, for the output to be 1, both of the input bits should be different—that is, one of the bits should be 1. When both bits are the same, `XOR` returns 0. The following truth table summarizes how the `XOR` operation works when processing two bits:

*0 xor 0 = 0*

*0 xor 1 = 1*

*1 xor 0 = 1*

*1 xor 1 = 0*

The following `XOR` operation on decimal `5` and `6` illustrates the working of the `xor()` function.

*5 = 101*

*6 = 110*

*5 and 6 = 011 which is decimal 3*

The following example shows how the `xor()` functions work:

$ vi xor.awkBEGIN { num1 = 5 num2 = 6 result ...