0

I am new to Scala and have run into a problem defining multi-dimensional arrays.

I have tried the following type specifications that did not compile:

val shortfall: Array[Array[Int]]= new Array (6,248)  
val shortfall= new  Array.ofDim[Int] (6,248)

The following specification compiled but does not allocate an instance of the array. The type spec for parameter passing was Array[Array[Int]].

val shortfall=  Array.ofDim[Int] (6,248)

I am converting a modeling application from Java with the following definition

int[][] shortfall = new int[6][248]
1
  • 2
    It's always a good idea to have a look at the API docs Commented Nov 3, 2013 at 10:22

1 Answer 1

2
scala> Array.ofDim[Int](6,248)
res0: Array[Array[Int]] = Array(Array(0, 0, 0, ...))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.