It looks like trying to draw a simple shape outside of the setup() or draw() functions causes an error (see attached). This works fine when placed in those functions. I realize it's not a best practice to structure sketches like this but wanted to let you know. I found this while working through the new P5.js course on Kadenze. Thanks!
Thanks for posting. This is actually just part of p5 - the functions only work within setup and draw (or functions that are called from within setup and draw)
It looks like trying to draw a simple shape outside of the setup() or draw() functions causes an error (see attached). This works fine when placed in those functions. I realize it's not a best practice to structure sketches like this but wanted to let you know. I found this while working through the new P5.js course on Kadenze. Thanks!