scala> Array.fill(3){ math.random }
<console>:6: error: value fill is not a member of object Array
Array.fill(3){ math.random }
Am I missing something here? I can’t get any of my book’s examples or even the examples write out of the scala source code to work.
Welcome to Scala version 2.7.7final (OpenJDK Server VM, Java 1.6.0_20)
Because
Arraydoesn’t have afillmethod in Scala 2.7.7… that’s pretty old. You should probably just upgrade to a more recent version. Here’s my output for the exact same code… note the version: