# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://george-jen.gitbook.io/data-science-and-apache-spark/array-in-scala.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
