09.10.2014 Views

Download Scala Tutorial (PDF Version) - Tutorials Point

Download Scala Tutorial (PDF Version) - Tutorials Point

Download Scala Tutorial (PDF Version) - Tutorials Point

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Processing Arrays:<br />

When processing array elements, we often use either for loop because all of the elements in an array are of the<br />

same type and the size of the array is known. Here is a complete example of showing how to create, initialize and<br />

process arrays:<br />

object Test {<br />

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

var myList = Array(1.9, 2.9, 3.4, 3.5)<br />

// Print all the array elements<br />

for ( x scala Test<br />

1.9<br />

2.9<br />

3.4<br />

3.5<br />

Total is 11.7<br />

Max is 3.5<br />

TUTORIALS POINT<br />

Simply Easy Learning

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

Saved successfully!

Ooh no, something went wrong!