I’ve just recently started coding and it says “unexcpected token: void” what’s up with my code? (it’s not finished yet, i’m just trying to run it)
Star[] stars = new Star[100]
void setup() {
size(400,400);
for (int i = 0; i < stars.length; i++) {
stars[i] = new Star();
}
}
void draw() {
background(0);
for (int i = 0; i < stars.length; i++) {
stars[i].update();
stars[i].show();
}
}
debxyz
March 7, 2020, 12:27am
2
Hello and welcome,
Your error is in this line. missing the semi-colon at end of line…
2 Likes
debxyz
March 7, 2020, 12:33am
3
Also, FYI, when you see an error message like this
the program is looking for semi-colon prior to a void function, and can’t find it. Hence the error message.
1 Like
thank you so much! I’ve only been coding for a couple of days so any help is tremendously appriciated!!
3 Likes
@noahgabeschaun – Welcome to the forum! When you post, please help us help you by formatting your code with the </> button or by adding ``` above and below. You can still edit your top post to fix it.