microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
billti/wgpu

Branches

Tags

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

Clone

HTTPS

Download ZIP

samples/language/Bool.qs

27lines · modecode

1/// # Sample
2/// Bool
3///
4/// # Description
5/// The `Bool` type represents Boolean values. Possible values are `true`
6/// or `false`.
7namespace MyQuantumApp {
8
9 @EntryPoint()
10 operation Main() : Bool {
11 // `Bool`s can be operated upon with boolean operators:
12 let andOp = true and true;
13 let orOp = false or true;
14
15 // Comparisons return booleans:
16 let eqComparison = 1 == 2;
17
18 // `if` expressions use boolean expressions as their conditions:
19 if (2 == 2) {
20 // do something
21 } else {
22 // do something else
23 }
24
25 return true;
26 }
27}