# Can we declare a var Stable?

**URL:** <https://forum.dfinity.org/t/can-we-declare-a-var-stable/11474>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [March 13, 2022, 4:35pm UTC](https://forum.dfinity.org/t/can-we-declare-a-var-stable/11474 "2022-03-13T16:35:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![HelloRickey](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/hellorickey/32/2020_2.png) [@HelloRickey](https://forum.dfinity.org/u/HelloRickey)\
**Post date:** [April 15, 2022, 2:44pm UTC](https://forum.dfinity.org/t/can-we-declare-a-var-stable/11474/2 "2022-04-15T14:44:49Z")

</div>

This might help you, you don’t need to change the Array, just use the Buffer when using the append method.

> [@What's the good way to add a new item in array?](https://forum.dfinity.org/t/whats-the-good-way-to-add-a-new-item-in-array/10993/6):
>
> ie. if I have the following: return Array.append\<Project\>(theProjectsNew, [newProject]); which appends a new object “newProject” to an array called “theProjectsNew” and replace it with: let theProjectsBuffer : Buffer.Buffer = Buffer.Buffer(theProjectsNew.size()); for (x in theProjectsNew.vals()) { theProjectsBuffer.add(x); }; theProjectsBuffer.add(newProject); return theProjectsBuffer.toArray(); the programatic results are the same … and the warning goes away … is this a valid way …

---

_[View the full topic](https://forum.dfinity.org/t/can-we-declare-a-var-stable/11474)._
