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 while compiling square.zok: expected ty_array #1384

Open
rashmeetk19 opened this issue Feb 6, 2025 · 1 comment
Open

Error while compiling square.zok: expected ty_array #1384

rashmeetk19 opened this issue Feb 6, 2025 · 1 comment

Comments

@rashmeetk19
Copy link

I am trying to compile a simple ZoKrates program to verify if a private number x satisfies x^2 == 16. However, I am encountering an error when I try to compile the program.

Here’s my code:
def main(private field x) -> field: field y = x * x assert y == 16 return y
When I run the following command:
zokrates compile -i square.zok
I get the following error:
square.zok: --> 1:30 | 1 | def main(private field x) -> field: | ^--- | = expected ty_array
I have tried:

  • Ensuring that the ZoKrates version is up to date (0.8.8).
  • Checking the formatting of the code.
  • Re-running the command multiple times.

Can anyone help me identify the cause of this issue and how to resolve it?

Thanks!

@dark64
Copy link
Member

dark64 commented Feb 6, 2025

def main(private field x) -> field {
    field y = x * x;
    assert(y == 16);
    return y;
}

Playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants