# Error Messages/40754

## Example error message

*The result index to Concat (fifth parameter, «K») is the wrong length. It has 1000 elements while a length of 50 is expected.*

## Cause

Consider the following call to Concat:

`Concat(A, B, I, J, K)`

`I`

is an index of `A`

, `J`

is an index of `B`

, and `K`

is the index that will index the concatenation. It must be the case that the length of `I`

plus the length of `J`

is equal to the length of `K`

. If not, you get this error.

Often people will define `K`

explicitly as Concat(I, J), which accomplishes this goal of making `K`

the correct length, even if `I`

or `J`

are changed in the future.

Other side notes:

The length of an index `I`

can be obtained as either: Size(I), Sum(1, I), or Size(I, ListLen: true). The last two always give the index length. The first, Size(I), usually does, but you have to be a little careful, because in the case where the parameter is a self-indexed array, then the parameter could be interpreted as either an index or an array depending on context. In fact, when `A`

is a self-indexed array, Size(A) returns the size of the array (number of array cells) rather than the index length. If `A`

has two or more dimensions, these are not equal. Setting the optional «listLen» parameter to true tells it that you want the index length (or more generally, the implicit dimension length) rather than the full array size.

## Remedies

Fix the index parameters to the Concat function so that the length of «I» plus the length of «J» is equal to the length of the result index «K».

Enable comment auto-refresher