# Understanding brackets array syntax documentation

**URL:** <https://discourse.mc-stan.org/t/understanding-brackets-array-syntax-documentation/27437>\
**Category:** Modeling\
**Tags:** specification, docs\
**Created:** [May 11, 2022, 3:23pm UTC](https://discourse.mc-stan.org/t/understanding-brackets-array-syntax-documentation/27437 "2022-05-11T15:23:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Erickson](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/richard_erickson/32/5705_2.png) [@Richard\_Erickson](https://discourse.mc-stan.org/u/Richard_Erickson)\
**Post date:** [May 11, 2022, 3:23pm UTC](https://discourse.mc-stan.org/t/understanding-brackets-array-syntax-documentation/27437/1 "2022-05-11T15:23:53Z")

</div>

I am trying to update my code to address this error:

```r
Warning in '/tmp/RtmpH9sgz3/model-3b673bc8c67.stan', line 38, column 2: Declaration
    of arrays by placing brackets after a variable name is deprecated and
    will be removed in Stan 2.32.0. Instead use the array keyword before the
    type. This can be changed automatically using the auto-format flag to
    stanc

```

and found the documentation page: [13.10 Brackets array syntax | Stan Reference Manual (mc-stan.org)](https://mc-stan.org/docs/2_29/reference-manual/brackets-array-syntax.html), but I am still confused. Specifically, I do not understand the double declaration of dimensions such as

```stan
matrix[7, 2] mu[15, 12];

```

becoming

```stan
array[15, 12] matrix[7, 2] mu;

```

Why are there two dimensions? `[15,12]` and `[7,2]`? And why don’t they match?

For example, how do I change

```stan
matrix[total_observations, m_delta] v_p;

```

to avoid this errors?

---

<div class="post-metadata">

**Author:** ![Richard\_Erickson](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/richard_erickson/32/5705_2.png) [@Richard\_Erickson](https://discourse.mc-stan.org/u/Richard_Erickson)\
**Post date:** [May 11, 2022, 3:26pm UTC](https://discourse.mc-stan.org/t/understanding-brackets-array-syntax-documentation/27437/2 "2022-05-11T15:26:51Z")

</div>

Also, if someone provide a link, I’m happy to take a stab at updating the docs once I understand what’s going on.

---

<div class="post-metadata">

**Author:** ![jsocolar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jsocolar/32/2486_2.png) [@jsocolar](https://discourse.mc-stan.org/u/jsocolar)\
**Post date:** [May 11, 2022, 4:27pm UTC](https://discourse.mc-stan.org/t/understanding-brackets-array-syntax-documentation/27437/3 "2022-05-11T16:27:43Z")

</div>

`matrix[7, 2] mu[15, 12];` declares a 15 x 12 array of 7 x 2 matrices. I think this was confusing to everybody, which is partly why it’s getting replaced with `array[15, 12] matrix[7, 2] mu;`.

This change shouldn’t affect `matrix[i, j] varname`, which is not declaring an array at all but rather is declaring an i x j matrix. Lines like this should not raise the deprecation warning.
