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

Probability #109

Open
LucasColas opened this issue Oct 13, 2019 · 5 comments
Open

Probability #109

LucasColas opened this issue Oct 13, 2019 · 5 comments

Comments

@LucasColas
Copy link

Hello, I'm trying to learn processing and I'm working on this exercise :

int [] stuff = new int[5]

stuff[0] = 1;
stuff[1] = 1;
stuff[2] = 2;
stuff[3] = 3;
stuff[4] = 3;

int index = int(random(stuff.length));

But I have an error : "Syntax error, maybe a missing ] character?"

Could you help me ?

@MagusX
Copy link

MagusX commented Oct 13, 2019

You miss the ";" at line 1 or maybe instead of int [] you should write int[]

@MonkeyDLy
Copy link

You missed a " ; " perhaps is that

@LucasColas
Copy link
Author

Thanks for the answer ! Now my code is :
int[] stuff = new int[5];

stuff[0] = 1;
stuff[1] = 1;
stuff[2] = 2;
stuff[3] = 3;
stuff[4] = 3;

int index = int(random(stuff.length));

And I have another error : "Missing right curly bracket "}" " and "unexpected token"...

@LucasColas
Copy link
Author

"unexpected token: [" exactly.

@LucasColas
Copy link
Author

Ok, I had to add {} : int[] stuff = new int[5]; {
stuff [0] = 1;
stuff [1] = 1;
stuff [2] = 2;
stuff [3] = 3;
stuff [4] = 3;

int index = int(random(stuff.length));

}

but why ?

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

3 participants