> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-and-apache-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-and-apache-spark/array-in-scala.md).

# Array in Scala

In Scala arrays are immutable objects.

```
var myArray : Array[Int] = new Array[Int](10);

/*
To create an Array with String data type, replace
Int with String
*/
```

*First you declare variable var myArray to be of type Array\[Int]. That is a Int array. If you had needed an array of e.g. String, replace String with String.*

Array is 0 base indexing, meaning index starts from 0

Once created, length of an array can not be changed.
