# How to append in a two dimensional array?

**URL:** <https://discourse.processing.org/t/how-to-append-in-a-two-dimensional-array/16359>\
**Category:** Beginners\
**Created:** [December 13, 2019, 5:30am UTC](https://discourse.processing.org/t/how-to-append-in-a-two-dimensional-array/16359 "2019-12-13T05:30:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AkaiKenshi](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@AkaiKenshi](https://discourse.processing.org/u/AkaiKenshi)\
**Post date:** [December 13, 2019, 5:30am UTC](https://discourse.processing.org/t/how-to-append-in-a-two-dimensional-array/16359/1 "2019-12-13T05:30:46Z")

</div>

I have a two dimensional array and I’m trying to append new values but I can’t figure out how to

```auto
int[][] prv = {{1},{1}};
int objX;
int objY;
void setup(){
size(200, 200)
}
void draw() {
  objX = mouseX;
  objY = mouseY; 
  println("objX: " + objX + ", objY: " + objY);
  println(prv);
}
void keyPressed() {
  if (key == 'e') {
    prv = append(prv, objY,objX);
  }
}

```

do you know any way to do this?

---

<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:** [December 13, 2019, 5:51am UTC](https://discourse.processing.org/t/how-to-append-in-a-two-dimensional-array/16359/2 "2019-12-13T05:51:52Z")

</div>

[Processing.org/reference/append\_.html](http://Processing.org/reference/append_.html)  
`prv = append(prv, objY, objX);`:  
`prv = (int[][]) append(prv, new int[] { objX, objY });`
