## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# The or (num1, num2) function

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

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

With the or operation, for the output to be 1, either of the bits given as input should be 1. The following truth table summarizes the or operation's working when processing two bits:

0 or 0 = 0

0 or 1 = 1

1 or 0 = 1

1 or 1 = 1

The following or operation on the decimal 5 and 6 illustrate the working of or() function:

5 = 101

6 = 110

5 or 6 = 111 which is decimal 7

The following example shows how the or() functions work:

`\$ vi or.awkBEGIN    {    num1 = 5    num2 = 6    result = or(num1,num2)    printf "(%d OR %d) = %d\n", num1, num2, result}\$ awk -f or.awk`

The output ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required