# Why does obXX\[0\] below in openprocessing not cause an error?

**URL:** <https://discourse.processing.org/t/why-does-obxx-0-below-in-openprocessing-not-cause-an-error/8197>\
**Category:** Beginners\
**Created:** [February 7, 2019, 8:37pm UTC](https://discourse.processing.org/t/why-does-obxx-0-below-in-openprocessing-not-cause-an-error/8197 "2019-02-07T20:37:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisjj](https://avatars.discourse-cdn.com/v4/letter/c/a698b9/32.png) [@chrisjj](https://discourse.processing.org/u/chrisjj)\
**Post date:** [February 7, 2019, 8:37pm UTC](https://discourse.processing.org/t/why-does-obxx-0-below-in-openprocessing-not-cause-an-error/8197/1 "2019-02-07T20:37:18Z")

</div>

Run this

```
void setup(){
all = new obXX[0];
}

```

[here](https://www.openprocessing.org/sketch/665143) in Chrome.

Expected: Error.

Observed: No error. Why?

PS `all = new obXX;` gives a ReferenceError as expected.

---

<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:** [February 9, 2019, 10:53pm UTC](https://discourse.processing.org/t/why-does-obxx-0-below-in-openprocessing-not-cause-an-error/8197/2 "2019-02-09T22:53:48Z")

</div>

My _guess_ – and I defer to Processing.js experts like @GoToLoop on this – is that this is because openprocessing uses Processing.js, and Processing.js is not bothering to enforce correctness in Java syntax when it compiles to JavaScript – instead, it is assuming that you are writing hybrid Java / Javascript, and attempting to interpret it as valid.

[http://processingjs.org/articles/jsQuickStart.html#javascriptonlyprocessingcode](http://processingjs.org/articles/jsQuickStart.html#javascriptonlyprocessingcode)

So, if you inspect your example using the code helper:

[http://processingjs.org/tools/processing-helper.html](http://processingjs.org/tools/processing-helper.html)

…you can see that the compiler has created an array and assigned it to “all”

```auto
// this code was autogenerated from PJS
(function($p) {
    function setup() {
        all = $p.createJavaArray('obXX', [0]);
    }
    $p.setup = setup;
    setup = setup.bind($p);
})

```

The section “Writing Documents that Combine Processing and JavaScript Code” seems like it might explain what is happening with that output.
