microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
source/pip/tests-integration/resources/adaptive_ri/input/IntegerComparison.qs
21lines · modecode
| 1 | namespace Test { |
| 2 | |
| 3 | import Std.Intrinsic.*; |
| 4 | |
| 5 | // Demonstrates use of integer comparisons. |
| 6 | // Expected output: (true, false, true) |
| 7 | @EntryPoint() |
| 8 | operation Main() : (Bool, Bool, Bool) { |
| 9 | mutable count = 0; |
| 10 | use q = Qubit(); |
| 11 | for _ in 1..10 { |
| 12 | X(q); |
| 13 | if M(q) == One { |
| 14 | X(q); |
| 15 | set count += 1; |
| 16 | } |
| 17 | } |
| 18 | Reset(q); |
| 19 | return (count > 5, count < 5, count == 10); |
| 20 | } |
| 21 | } |
| 22 | |