Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Control Flow example #480

Closed
so-suzuki-kke opened this issue Aug 8, 2019 — with docs.microsoft.com · 0 comments
Closed

Control Flow example #480

so-suzuki-kke opened this issue Aug 8, 2019 — with docs.microsoft.com · 0 comments
Labels
bug Resolution-Done Issue closed because work item completed.

Comments

Copy link

I think that the variable "i" should be "index" in following code (control flow example).

// ...
for (qb in qubits) { // qubits contains a Qubit[]
H(qb);
}

mutable results = new (Int, Results)[Length(qubits)];
for (index in 0 .. Length(qubits) - 1) {
let measured =
set results w/= index <- (index, M(qubits[i]));
}

mutable accumulated = 0;
for ((index, measured) in results) {
if (measured == One) {
set accumulated += 1 <<< index;
}
}


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@bromeg bromeg added the bug label Aug 29, 2019
cgranade added a commit that referenced this issue Sep 6, 2019
@cgranade cgranade mentioned this issue Sep 6, 2019
cgranade pushed a commit that referenced this issue Sep 19, 2019
@cgranade cgranade added the Resolution-Done Issue closed because work item completed. label Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Resolution-Done Issue closed because work item completed.
Projects
None yet
Development

No branches or pull requests

3 participants