Skip to content

Commit c78bc9b

Browse files
committed
clarify empty array expression
1 parent 17d4097 commit c78bc9b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/reference-manual/expressions.qmd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ array[2, 3] int b = { { 1, 2, 3 },
334334
{ 4, 5, 6 } };
335335
```
336336

337+
The empty array expression (`{ }`) is not allowed. See more about restrictions on array expressions in subsection [Restrictions on values](#array-expressions).
337338

338339
### Array expression types {-}
339340

@@ -417,6 +418,13 @@ zero-element array.
417418
array[0] int a; // a is fully defined as zero element array
418419
```
419420

421+
If needed, it is also possible to create an empty array with
422+
```stan
423+
rep_array(0, 0)
424+
```
425+
where the type of the first argument determines the type of the array
426+
(e.g., real or int).
427+
420428
#### No zero-tuples or one-tuples {-}
421429

422430
There is no way to declare or construct a zero-tuple or one-tuple in

0 commit comments

Comments
 (0)