The array is a common data structure consisting of a collection of elements of the same type. Elements are associated with an index, usually an integer, which is used to access or replace a particular element. Learn more about how arrays can be utilized i
- [Narrator] The array is a common data structure…consisting of a collection of elements of the same type.…Now, the same type can be anything from any to AnyVal…to specific types, such as ints, doubles, et cetera.…Elements are associated with an index, usually an integer,…which is used to access or replace a particular element.…Basically, there are two ways to define an array.…Either you can specify the total number of elements…and then assign values to the elements,…or you can specify all the values at once.…Let's create some arrays.…
I'm going to start by creating an array called movies,…and I'm going to say that movies is of type Array…and it's going to hold data types of type String.…I can say that's equal to a new array.…Notice the square brackets around my data type.…And then I want to say that I'm going to…have five elements in my movies array.…Now I can add movies by typing in movies and putting in…the index value and saying that that's equal to,…let's do Harry Potter and The Sorcerers Stone.…
Now that array has one element and it has four empty spots.…
- Installing Scala
- Integrating with IDEs
- Creating variables
- Using special functions
- Basic types and operations
- Tuples, sets, maps, arrays, and lists
- Classes, fields, and methods
- Singleton objects
Skill Level Intermediate
1. Why Scala?
2. Scala Basics
3. More Scala Basics
4. Objects with Scala
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.