microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.25.1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

library/std/src/Std/Logical.qs

31lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4
5/// # Summary
6/// Returns the boolean exclusive disjunction (eXclusive OR, XOR)
7/// of two input boolean values.
8///
9/// # Input
10/// ## first
11/// The first boolean value to be considered.
12///
13/// ## second
14/// The second boolean value to be considered.
15///
16/// # Output
17/// A `Bool` which is `true` if and only if exactly one of `first` and `second` is `true`.
18///
19/// # Remarks
20/// In Q#, `Xor(a, b)` is equivalent to `a != b`.
21///
22/// # Example
23/// ```qsharp
24/// let result = Xor(true, false);
25/// // result is true
26/// ```
27function Xor(first : Bool, second : Bool) : Bool {
28 first != second
29}
30export Xor;
31
32