# Is it unable to define objects using a "class" keyword on the p5.js mode on Processing

**URL:** <https://discourse.processing.org/t/is-it-unable-to-define-objects-using-a-class-keyword-on-the-p5-js-mode-on-processing/18678>\
**Category:** p5.js\
**Created:** [March 15, 2020, 1:02pm UTC](https://discourse.processing.org/t/is-it-unable-to-define-objects-using-a-class-keyword-on-the-p5-js-mode-on-processing/18678 "2020-03-15T13:02:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arigat](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@arigat](https://discourse.processing.org/u/arigat)\
**Post date:** [March 15, 2020, 1:02pm UTC](https://discourse.processing.org/t/is-it-unable-to-define-objects-using-a-class-keyword-on-the-p5-js-mode-on-processing/18678/1 "2020-03-15T13:02:25Z")

</div>

I use the p5.js mode on Processing 3.5.4, and run a sample “ex02\_Multiple\_Objects” from a Objects group.  
I get the following error:  
SyntaxError: Expected an operand but found class.

If I open index.html on a browser (Chrome and Safari) from a sketch folder, it works fine.

I can not understand the reason. Is this the specification of the p5.js mode on Processing IDE? Is it unable to define objects using a “class” keyword on the p5.js mode on Processing IDE?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 25, 2020, 12:53am UTC](https://discourse.processing.org/t/is-it-unable-to-define-objects-using-a-class-keyword-on-the-p5-js-mode-on-processing/18678/2 "2020-03-25T00:53:37Z")

</div>

It sounds like either:

1. your sketch in PDE does not have “p5.js mode” selected, and you are running in e.g. Java mode
2. you accidentally made a change to the example and saved it, deleting lines immediately before the class line. “Expecting an operand” means the compiler was looking for e.g. ‘+’ – that shouldn’t happen if the last thing was a function closing correctly with }

There are more exotic possibilities, but those are guesses to start. If you cut and paste the example into the [editor.p5js.org](http://editor.p5js.org), what happens?

---

<div class="post-metadata">

**Author:** ![arigat](https://avatars.discourse-cdn.com/v4/letter/a/f17d59/32.png) [@arigat](https://discourse.processing.org/u/arigat)\
**Post date:** [March 30, 2020, 4:09am UTC](https://discourse.processing.org/t/is-it-unable-to-define-objects-using-a-class-keyword-on-the-p5-js-mode-on-processing/18678/3 "2020-03-30T04:09:33Z")

</div>

Thank you for your reply.  
What you wrote is exactly right, but my situation is not either.  
I use Processing 3.5.4 with p5.js mode 1.2.2 on Windows 10.  
If I run a code for ex01\_Objects in “Sample” on the [editor.p5js.org](http://editor.p5js.org), it works. However, I want to use p5.js mode in Processing IDE. Is there any problem in p5.js mode in Processing IDE?
