And function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Bitwise

Package: Microsoft.Quantum.QSharp.Foundation

Returns the bitwise AND of two integers. This performs the same computation as the built-in &&& operator.

function And (a : Int, b : Int) : Int

Input

a : Int

b : Int

Output : Int

Example

let a = 248;       //                11111000₂
let b = 63;        //                00111111₂
let x = And(a, b); // x : Int = 56 = 00111000₂.

Remarks

See the C# & Operator (binary) for more details.