# Asymptote: How to use nested arrays?

How would I create a nested array in Asymptote such as `[[1,2,3],[4,5,6]]` and call upon element 1 of array 1 and such?

• Does the discussion in section 2.15 of this nice tutorial help? – user121799 Feb 9 '19 at 20:13
• Kind of, but I still don't fully understand the syntax. How would you define such an array such as my example [[1,2,3],[4,5,6]] above? – James Palmer Feb 9 '19 at 20:40
• Generally you are much more likely to get a concrete answer if you post a concrete question. In your case this would be an asymptote code that attempts to use an array. Then the one who is willing to write an answer will know whether you are talking about integers or reals and so on, and in particular does not have to type so much themselves. – user121799 Feb 9 '19 at 21:51
• Note to close/reopen-voters: Asymptote (like Metapost) is part of the TeX ecosystem even though its syntax does not resemble standard TeX syntax. See tex.meta.stackexchange.com/questions/3518/…. Also note that the Asymptote tag has 7 questions on Stackoverflow versus 403 on TeX.SX. – Charles Staats Feb 10 '19 at 1:39

Illustration in interactive mode:

``````\$ asy
Welcome to Asymptote version 2.41 (to view the manual, type help)
> int[][] a = {{1,2,3},{4,5,6}};
> a  // please print a
1   2   3
4   5   6
> a[1][1]  // index-1 entry of index-1 array in a
5
> a[1]  // index-1 array in a
0:  4
1:  5
2:  6
``````
• Nice to see you back! And I fully agree with your above comment. – user121799 Feb 10 '19 at 3:09