# Square is not defined (?)

**URL:** https://discourse.processing.org/t/square-is-not-defined/11536
**Category:** Beginners
**Created:** [May 24, 2019, 8:04am UTC](https://discourse.processing.org/t/square-is-not-defined/11536 "2019-05-24T08:04:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@Laurent](https://discourse.processing.org/u/Laurent)
#### Post date: [May 24, 2019, 8:04am UTC](https://discourse.processing.org/t/square-is-not-defined/11536/1 "2019-05-24T08:04:19Z")

</div>

Hi everyone,

Sorry for this very basic question, but I’ve got the following error when using the square() function of p5.js, even if using the rect() function instead works very well :

Uncaught ReferenceError: **square is not defined**

See the code below. Any idea?

Thanks a lot 😄

Laurent

```auto
var canvasWidth;
var canvasHeight;

function setup() {

  canvasWidth = 800;
  canvasHeight = 400;
  
  createCanvas(canvasWidth, canvasHeight);
  background(255);
  stroke(0);
  rect(30, 20, 55, 55);  
  square(30, 20, 55);
  
}

```

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [May 24, 2019, 9:09am UTC](https://discourse.processing.org/t/square-is-not-defined/11536/2 "2019-05-24T09:09:56Z")

</div>

> [@Laurent](#):
>
> Uncaught ReferenceError: **square is not defined**

It runs if I paste your code in [My Sketch - OpenProcessing](http://OpenProcessing.org/sketch/create) and click the play ▶ icon. 🏃‍♂️

And I’ve got this sketch using [**square()**](http://p5js.org/reference/#/p5/square) too: ⬛  
[GoSubRoutine.GitHub.io/Ball-in-the-Chamber/global/](http://GoSubRoutine.GitHub.io/Ball-in-the-Chamber/global/)  
[https://github.com/GoSubRoutine/Ball-in-the-Chamber/blob/v2.0.3/global/sketch.js#L105-L108](https://github.com/GoSubRoutine/Ball-in-the-Chamber/blob/v2.0.3/global/sketch.js#L105-L108)
