BitOr

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

BitOr( value_1, [ value_2, ... ] )
BitOr( value_1, [ value_2, ... ] )
BitOr( value_1, [ value_2, ... ] )
bitor( value_1, [ value_2, ... ] )
BitOr( value_1, [ value_2, ... ] )

Description

The BitOr function returns the bit in the result if the bit exists in any argument. The arguments must be numbers, and the fractional portion is truncated before the or operation is applied. The result is the bitwise OR of all the arguments.

Parameters

Parameter Type Definition and Requirements

value

List of Numbers

One or more numbers to bitwise OR.

Returns

A Number which is the bitwise OR of all supplied values.

Examples

The following query executes an array of independent bitwise OR operations and returns results in the result array. The result array position matches the position in the execution array.

try
{
    Value result = await client.Query(
        Arr(
            BitOr(7),
            BitOr(0, 0),
            BitOr(1, 0),
            BitOr(1, 1),
            BitOr(6, 3)
        )
    );

    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
Arr(LongV(7), LongV(0), LongV(1), LongV(1), LongV(7))
result, err := client.Query(
	f.Arr{
		f.BitOr(7),
		f.BitOr(0, 0),
		f.BitOr(1, 0),
		f.BitOr(1, 1),
		f.BitOr(6, 3),
	})

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
[7 0 1 1 7]
client.query(
  [
    q.BitOr(7),
    q.BitOr(0, 0),
    q.BitOr(1, 0),
    q.BitOr(1, 1),
    q.BitOr(6, 3),
  ]
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
[ 7, 0, 1, 1, 7 ]
result = client.query(
  [
    q.bitor(7),
    q.bitor(0, 0),
    q.bitor(1, 0),
    q.bitor(1, 1),
    q.bitor(6, 3),
  ]
)
print(result)
[7, 0, 1, 1, 7]
[
  BitOr(7),
  BitOr(0, 0),
  BitOr(1, 0),
  BitOr(1, 1),
  BitOr(6, 3),
]
[ 7, 0, 1, 1, 7 ]
Query metrics:
  •    bytesIn:  77

  •   bytesOut:  24

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 3ms

  •    retries:   0

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!