We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey everyone, I'm desperately trying to fix this "unexpected token: void" problem, but I just can't help it. I'm new to Processing and probably the solution is obvious.. The error occurs in the last method. Maybe you could give me a hint ..
void draw() {
int passedTime = millis() - savedTime;
if(passedTime > totalTime) {
return;
}
void checkout() {
for(Object o : ArrayField) {
if(o.next().getObject instanceof Key) {
return;
}
}
}
}
Answers
Looks like you've got to functions, draw() and checkout(), but you're defining checkout() inside draw()! Maybe you should try moving the } on line 18 to line 8?
yes
when you press ctrl-t the code gets auto-format
then you would see it
it's just that { and } must always match in pairs
{ and }
{{ and }} etc.
Okay, I put the checkout() outside of draw, and draw is closed properly now. Nevertheless I get the same error, even though every method is closed.. It seems to me that there's something wrong inside checkout(), still got any ideas?
*Edit: it's not the same error, now it's just "Unexpected token: [ " *Edit 2: Ok sorry, got it fixed, I just realized I forgot to call the array inside the if.
Great, you got it. I'm glad.
;-)