Multiple dimensional arrays

Yes, Scala’s Array type is equivalent to Java arrays and therefore JVM arrays, which do not have a low level notion of multiple dimensions. A multidimensional array is always just an array of arrays.

The type of the array also only encodes the number of dimension, but not their size, so you couldn’t write a function signature specifying a 3x3 Array anyway, your type can only specify, that it should be 2D (e.g. Array[Array[Int]] here).

If you want to have a function, where you can only pass in a certain shape of array, you’ll have to roll your own Matrix class or look for a library that provides this.

That would be one way to implement it. Alternatively, you could maybe use something like refined or shapeless to add additional constraints to types, which admittedly doesn’t have the nicest syntax.