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

Error in the "Control Flow" section of Noir documentation #3315

Closed
TAdev0 opened this issue Oct 27, 2023 · 1 comment
Closed

Error in the "Control Flow" section of Noir documentation #3315

TAdev0 opened this issue Oct 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@TAdev0
Copy link
Contributor

TAdev0 commented Oct 27, 2023

Aim

While starting to learn how to use Noir language and Nargo, i noticed there is an error the "Control Flow" section of Noir documentation :

https://noir-lang.org/language_concepts/control_flow

The first ''Loop'' section says :
The index for loops is of type u64.

After a few tests, i confirm the index of a loop is of type field.

Expected Behavior

The documentation should be modified to replace u64 by field .

Bug

This compiles well :

    for i in 0..8 {
        for j in 0..8 {                   
             if (i as u32) + (j as u32) < 8) {
             ...
             }
        }
    }

whereas this will throw an error :

    for i in 0..8 {
        for j in 0..8 {                   
             if (i + j < 8) {
             ...
             }
        }
    }

AssertionError: error: Comparisons are invalid on Field types. Try casting the operands to a sized integer type first

Installation Method

Noirup

Nargo Version

nargo 0.15.0 , nargo 0.17.0, nargo 0.10.5

Would you like to submit a PR for this Issue?

Yes

@TAdev0 TAdev0 added the bug Something isn't working label Oct 27, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Oct 27, 2023
@TAdev0
Copy link
Contributor Author

TAdev0 commented Nov 28, 2023

@kevaundray should i propose a PR for this ? i'm willing to contribute to Noir ecosystem but i didn't get any answer for a month. Thank you!

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants