microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.3.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

samples/language/Bool.qs

27lines · modepreview

/// # Sample
/// Bool
///
/// # Description
/// The `Bool` type represents Boolean values. Possible values are `true`
/// or `false`.
namespace MyQuantumApp {

    @EntryPoint()
    operation Main() : Bool {
        // `Bool`s can be operated upon with boolean operators:
        let andOp = true and true;
        let orOp = false or true;

        // Comparisons return booleans:
        let eqComparison = 1 == 2;

        // `if` expressions use boolean expressions as their conditions:
        if (2 == 2) {
            // do something
        } else {
            // do something else
        }

        return true;
    }
}