28.08.2016 Views

scala_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Scala<br />

The following is the example of defining a two-dimensional array:<br />

var myMatrix = ofDim[Int](3,3)<br />

This is an array that has three elements each being an array of integers that has three<br />

elements.<br />

Try the following example program to process a multi-dimensional array:<br />

import Array._<br />

object Demo {<br />

def main(args: Array[String]) {<br />

var myMatrix = ofDim[Int](3,3)<br />

// build a matrix<br />

for (i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!