Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language Feature: Loop shortcut constructs #1835

Open
idavis opened this issue Aug 13, 2024 · 0 comments
Open

Language Feature: Loop shortcut constructs #1835

idavis opened this issue Aug 13, 2024 · 0 comments
Labels

Comments

@idavis
Copy link
Collaborator

idavis commented Aug 13, 2024

Add break and continue as statements.

for i in 1..5 {
    if i == 4 {
        break;
    }
    continue;
}

Only legal in while and for loops.

break moves execution to the statement following the block expression. Using break or continue within a block changes that blocks type to Unit

Unknowns

  • behavior of break/continue based on quantum measurements
  • behavior in conjugate expressions
     within {
         for i in 1..5 {
             if i == 4 {
                 break;
             }
             continue;
         }
     }
     apply {
         X(q);
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants