Scala Multidimensional Array
Multidimensional array is an array which store data in matrix form. You can create from two dimensional to three, four and many more dimensional array according to your need. Below we have mentioned array syntax. Scala provides an ofDim method to create multidimensional array.
Multidimensional Array Syntax
Scala Multidimensional Array Example by using ofDim
In This example, we have created array by using ofDim method.
0 0 15 0 Third Element = 0
Scala Multidimensional Array by using Array of Array
Apart from ofDim you can also create multidimensional array by using array of array. In this example, we have created multidimensional array by using array of array.
1 2 3 4 5 6 7 8 9 10
Scala Addition of Two Matrix Example
You can manipulate array elements in scala. Here, we are adding two array elements and storing result into third array.
2 4 6 8 10 12 14 16 18 20