# Why is the function Fill not found? but the rest of the functions on the library yes?

**URL:** <https://discourse.processing.org/t/why-is-the-function-fill-not-found-but-the-rest-of-the-functions-on-the-library-yes/5447>\
**Category:** Coding Questions\
**Created:** [November 11, 2018, 2:38pm UTC](https://discourse.processing.org/t/why-is-the-function-fill-not-found-but-the-rest-of-the-functions-on-the-library-yes/5447 "2018-11-11T14:38:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gio](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gio/32/2313_2.png) [@gio](https://discourse.processing.org/u/gio)\
**Post date:** [November 11, 2018, 2:38pm UTC](https://discourse.processing.org/t/why-is-the-function-fill-not-found-but-the-rest-of-the-functions-on-the-library-yes/5447/1 "2018-11-11T14:38:39Z")

</div>

Im workingon a P5.js sketch…

Instead of creating objects with a constructor function, and then using the new keyword.

I want to use a factory function.

It seems to work fine, and renders correclty when using for example this code:

```auto
 stroke(255,0,0)
 ellipse(speed, 10, 10, 10)

```

But at the moment i try to use `fill(255)` , i get an error saying fill is not a function?

How is it possible that only this function from p5 is not being recognized but others yes?

Here is a codepen: [https://codepen.io/giorgiomartini/pen/VVKMKg?editors=0011](https://codepen.io/giorgiomartini/pen/VVKMKg?editors=0011)

Code:

```auto
function setup () {
  createCanvas(300,500)
  background(3)
  bola = createCircle(circleOpts)
}

const circleOpts = {
  fill: 255,
  x: 0,
  y: 0,
  maxRadius: 10,
}

const createCircle = ({fill = 255, x = 10, y = 10, maxRadius = 20}) => {
 let speed = 0
 return {
   display() {
     noStroke()
     background(2)
     stroke(255,0,0)
     // if you remove this next line it works!
     fill(255)
     ellipse(speed, 10, 30, 30)
   }
 }
} 

let bola

function draw () {
   bola.display()
}

```

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [November 11, 2018, 2:57pm UTC](https://discourse.processing.org/t/why-is-the-function-fill-not-found-but-the-rest-of-the-functions-on-the-library-yes/5447/2 "2018-11-11T14:57:50Z")

</div>

You have fill in the factory definition and fill as a function from p5.js. Rename the first one and your code will work.

Kf
