Why does the error comes even though the function is defined?

here is the link to my project https://editor.p5js.org/rohitgokul817/sketches/yhOcLU2KX

please help me to figure out the error the function is defined buti am getting the error Uncaught ReferenceError: antsweets is not defined (sketch: line 164)

please help me as soon as possible

1 Like

Try running Edit > Tidy Code.

You are almost certainly missing a } higher up, and so some of your functions are nested inside later functions.

It is impossible to tell, though, because your indenting is so messy.