# P5 value changed bug

**URL:** <https://discourse.processing.org/t/p5-value-changed-bug/1056>\
**Category:** p5.js\
**Created:** [June 18, 2018, 12:14pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056 "2018-06-18T12:14:32Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 18, 2018, 12:14pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/1 "2018-06-18T12:14:33Z")

</div>

Every time i used p5.js, it says “You just changed the value of “`something`”, which was a p5 function. This could cause problems later if you’re not careful.”. It still works, but when i created a canvas, it showed 2 and everything I did it did it twice. Anyone has got a fix to this? If so, thanks!

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [June 18, 2018, 12:31pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/2 "2018-06-18T12:31:56Z")

</div>

You changed the value of… what? Of `something`? Do you have a variable named `something`? Could you rename it? It’s basically impossible to help you without seeing the exact error and a snippet of code that demonstrates the error…

---

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 18, 2018, 12:45pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/3 "2018-06-18T12:45:38Z")

</div>

oh the something was just a replacement for all the errors.  
[Here’s](https://hastebin.com/bociwikoja.py) the actual error.

---

<div class="post-metadata">

**Author:** ![kjhollen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kjhollen/32/23_2.png) [@kjhollen](https://discourse.processing.org/u/kjhollen)\
**Post date:** [June 18, 2018, 6:53pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/4 "2018-06-18T18:53:29Z")

</div>

Hi @Galaxy, can you share the code for your index.html with us? I think what you’re seeing can happen if you include p5 multiple times—let’s see if that’s happening. 🙂

---

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 19, 2018, 3:52am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/5 "2018-06-19T03:52:40Z")

</div>

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/87d63fee4546248e6235e142a433521143b71255.png)  
Here is my html code.

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [June 19, 2018, 6:08am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/6 "2018-06-19T06:08:06Z")

</div>

Well, you have both p5.js and p5.min.js included, don’t you?

I’d try removing the 4th “`<script>...</script>`” line… See if that helps…

---

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 19, 2018, 6:28am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/7 "2018-06-19T06:28:52Z")

</div>

But i thought i was supposed to use both of them? A few weeks ago there wasn’t any problems, this just suddenly happen. I’ll try it and see.

---

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 19, 2018, 7:28am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/8 "2018-06-19T07:28:52Z")

</div>

Thanks, it worked. So I am just supposed to use the p5.js file instead of using both p5.js and p5.min.js files next time? It used to work

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [June 19, 2018, 10:04am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/9 "2018-06-19T10:04:00Z")

</div>

One or the other, but not both. I’m not sure what the difference is myself. One is “compressed” and the other isn’t, but that’s not super informative.

---

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 19, 2018, 11:08am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/10 "2018-06-19T11:08:21Z")

</div>

Alright then. Thanks for helping me.

---

<div class="post-metadata">

**Author:** ![kjhollen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kjhollen/32/23_2.png) [@kjhollen](https://discourse.processing.org/u/kjhollen)\
**Post date:** [June 19, 2018, 9:29pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/11 "2018-06-19T21:29:09Z")

</div>

Great! Glad you worked this out. Also, FYI we have a bug open in the project to make it easier for users to figure out if this happens in the future: [https://github.com/processing/p5.js/issues/2681](https://github.com/processing/p5.js/issues/2681)

---

<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:** [June 20, 2018, 5:43pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/12 "2018-06-20T17:43:51Z")

</div>

> [@Galaxy](#):
>
> But i thought i was supposed to use both of them?

> [@Galaxy](#):
>
> Thanks, it worked. So I am just supposed to use the p5.js file instead of using both p5.js and p5.min.js files next time? It used to work

Yes, use **either** one **or** the other.

I believe that using both causes a pile of warnings because the second library loading redefines all of the exact same methods in the first one – you are overwriting the first library piece by piece (with an almost identical minified or maxified copy), and getting a warning every step of the way.

---

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 20, 2018, 6:03pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/13 "2018-06-20T18:03:32Z")

</div>

Oooh, thanks for the information.

---

<div class="post-metadata">

**Author:** ![Galaxy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/galaxy/32/482_2.png) [@Galaxy](https://discourse.processing.org/u/Galaxy)\
**Post date:** [June 20, 2018, 6:04pm UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/14 "2018-06-20T18:04:20Z")

</div>

I’ll be sure to use it the next time I encounter a bug.

---

<div class="post-metadata">

**Author:** ![bmoren](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bmoren/32/68_2.png) [@bmoren](https://discourse.processing.org/u/bmoren)\
**Post date:** [June 21, 2018, 3:51am UTC](https://discourse.processing.org/t/p5-value-changed-bug/1056/15 "2018-06-21T03:51:21Z")

</div>

Chiming in for future reference and to help make this answer fully complete! The difference between a regular js file and a `min` js file is that all of the white space (returns, spaces, etc.) has been removed in the `min` version. It’s not exactly compressed per se, but the white space is unnecessary data (as far as the computer/browser is concerned), and is stripped out. The regular p5.js file has all of this formatting and white space and is the human readable version.

currently (v0.6.1)  
the `p5.js` file is 2.8mb  
the `p5.min.js` file is 399kb  
So using the `min` is substantially smaller which would result in faster downloads and less bandwidth usage.

Generally speaking it’s best to go with the `min` for speed and efficiency, but you might want the p5.js file to look at what is actually happening under the hood in a human readable format for debugging, learning, or adding on.

It’s a good idea to open each of these in your text editor and have a look! functionally they do the same thing, but they look _very_ different.
