Array Types Array types are used for representing arrays with an underlying type being an internal type. For valid internal types, array types can be declared using the type[] syntax as follows: 123int[] arr1; // Array of 'int' valuesstring[] arr2; // Array of 'string' valuesbool[] arr3; // Array of 'bool' values By using array types, the compiler guarantees the elements of the array will be restricted to the declared underlying type. External Arrays The syntax for array types can only be used for internal types. For external types, there is no special syntax. Externally-typed arrays will fit into variables declared using var, function, or external: 1234var foo = [ "string", 100, false ];function bar() { return [ true, 1 ];} Internal Arrays with External Elements In order to explicitly declare an internally-typed array with external elements, use the System.Array class: 1System.Array<external> foo = [ true, 1, "string" ]; An internally-typed array with external elements enables compile-time checking and analysis. For example, the compiler can ensure only valid array methods are called. Arrays of Arrays Arrays of arrays (jagged arrays) can be declared with the following syntax: 1int[][] arr; In order to access elements of the jagged arrays above: 1arr[0][1]; // Accesses the second element (at index 1) of the first array inside the 'arr' array See Also System.Array Array Literal Expressions Auto-boxing and Unboxing Variable Declarations Function Declarations Share HTML | BBCode | Direct Link