# 2D array works, but then not

**URL:** <https://forum.makecode.com/t/2d-array-works-but-then-not/12006>\
**Category:** Adafruit Circuit Playground Express\
**Created:** [February 2, 2022, 11:10pm UTC](https://forum.makecode.com/t/2d-array-works-but-then-not/12006 "2022-02-02T23:10:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rick314](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rick314/32/5621_2.png) [@Rick314](https://forum.makecode.com/u/Rick314)\
**Post date:** [February 2, 2022, 11:10pm UTC](https://forum.makecode.com/t/2d-array-works-but-then-not/12006/1 "2022-02-02T23:10:19Z")

</div>

I am using the “Microsoft MakeCode for Circuit Playground Express” app on a Windows 10 PC. The following JavaScript works fine – It converts between Blocks and JavaScript. The Console output is as expected. The .uf2 file can be save file to hard drive. No problems.

```auto
let array2D = [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
console.logValue("array2DLen", array2D.length)
console.logValue("array2D[0]Len", array2D[0].length)
console.logValue("array2D[1]Len", array2D[1].length)
console.logValue("array2D[2]Len", array2D[2].length)
for (let idx0 = 0; idx0 <= array2D.length - 1; idx0++) {
    for (let idx1 = 0; idx1 <= array2D[idx0].length - 1; idx1++) {
        console.logValue("[][]", array2D[idx0][idx1])
    }
}

```

But change the array to what I really want to use in my program:  
[[16515072, 14164992, 11553792, 8942592, 6331392, 3981312, 1370112, 60432, 50232, 40032, 30852, 20652, 10452, 252, 2359512, 4718772, 7340172, 9961572, 12582972, 14942232], [16711680, 14622720, 12533760, 10444800, 8421376, 6332160, 4243200, 2154240, 65280, 57120, 48960, 40800, 32896, 24735, 16575, 8415, 255, 2097375, 4194495, 6291615, 8388736, 10420320, 12517440, 14614560], [16711680, 16524288, 15880448, 14385920, 11842560, 8641280, 5370368, 2423808, 65280, 64548, 62033, 56195, 46260, 33755, 20978, 9468, 255, 2359548, 5308658, 8585435, 11796660, 14352515, 15859793, 16515108]]

That is an array of 3 arrays with length 20, 24, and 24. It still converts fine between JavaScript and Blocks, and Console output is as expected. (So far so good.) But trying to save it to hard drive results in “ **Compilation failed, please check your program for errors.** ”

**Is this a defect or documented somewhere as expected behavior?**  
**Where is the best place to submit issues like this?**

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [February 2, 2022, 11:41pm UTC](https://forum.makecode.com/t/2d-array-works-but-then-not/12006/2 "2022-02-02T23:41:06Z")

</div>

This is definitely a bug! Thanks for reporting. I created an issue for it here:

> <https://github.com/microsoft/pxt-adafruit/issues/1207>
>
> Reported on the forum here: https://forum.makecode.com/t/2d-array-works-but-then…-not/12006
> 
> For some reason the assembler doesn't seem to like arrays with a bunch of large numbers. This does not repro in arcade or micro:bit; just adafruit. The fix is probably just to update PXT
> 
> Here's a minimal repro:
> 
> \`\`\`ts
> let array2D = \[
> 16515072, 14164992, 11553792, 8942592, 6331392, 3981312, 1370112, 60432, 50232, 40032, 30852, 20652, 10452, 2359512, 4718772, 7340172, 9961572, 12582972, 14942232,
> 16711680, 14622720, 12533760, 10444800, 8421376, 6332160, 4243200, 2154240, 65280, 57120, 48960, 40800, 32896, 24735, 16575, 8415, 255, 2097375, 4194495, 6291615, 8388736
> \];
> 
> console.log(array2D.length)
> \`\`\`
> 
> Note that you have to try and download to hardware to get the error to show up.

You can file any other issues you find in that repository
