====== Array ====== An Array is a collection of values. You can use the [[editor:blocks:variables:set-array|Set Array]] command to store values in the array.\\ You can describe an Array in the following way\\ {{:editor:blocks:variables:1d_array_example.png|}}\\ Let's say you want to create an Array with the values of "one", "two" and "three". You can do it in the following way\\ {{:editor:blocks:variables:array.png|}} In order to access the array values, you need to use the [] syntax. \\ arr1[0] value is "one"\\ arr1[1] value is "tow"\\ arr1[2] value is "three"\\ In order to know the Array length, you can use ".length" syntax.\\ arr1.length is 3\\ Here is an example of iterating through the arr1 array values and display them in a [[editor:blocks:2d-models:label|Label]]\\ {{:editor:blocks:variables:array_example1.png|}}\\ http://www.gamemaker3d.com/player?pid=01615828 ===== 2D Array ===== A two-dimensional Array is a collection of Arrays. It means that every value in the array is an Array itself.\\ You can describe a 2D Array in the following way\\ {{:editor:blocks:variables:2d_array_example.png|}}\\ You can use the [[editor:blocks:variables:set-array|Set Array]] command to store values in the a 2D Array by using the x,y parameters as the cell position in the array.\\ You will need to set the following x,y position in order to build the above array\\ x=1, y=1 value = "a"\\ x=2, y=1 value = "b"\\ x=3, y=1 value = "c"\\ x=1, y=2 value = "d"\\ x=2, y=2 value = "e"\\ x=3, y=2 value = "f"\\ x=1, y=3 value = "g"\\ x=2, y=3 value = "h"\\ x=3, y=3 value = "i"\\ You can use the [[editor:blocks:animation:for|For]] command to build an array and set its values.\\ Here is an example of building a 2D Array with the multiplication table\\ {{:editor:blocks:variables:2d_array_set_example.png|}}\\ http://www.gamemaker3d.com/player?pid=01615844 You can use the [][] syntax to access the 2D Array values\\ arr1[0][0] value is 0\\ arr1[5][4] value is 20\\ arr1[3][5] value is 15\\ .\\ .\\ .\\ {{ :editor:blocks:info-148099_960_720.png?20|}}//MORE INFORMATION// ---- * [[editor:blocks:variables:increment|]] * [[editor:blocks:variables:set-array|]] * [[editor:blocks:variables:set-random|]] * [[editor:blocks:variables:set|]] * [[editor:blocks:variables:setup|]] * [[editor:blocks:variables:var|]]