28.08.2016 Views

scala_tutorial

Create successful ePaper yourself

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

Scala<br />

object Demo {<br />

}<br />

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

}<br />

var a = 0;<br />

// for loop execution with a range<br />

for( a <strong>scala</strong>c Demo.<strong>scala</strong><br />

\><strong>scala</strong> Demo<br />

Output<br />

value of a: 1<br />

value of a: 2<br />

value of a: 3<br />

value of a: 4<br />

value of a: 5<br />

value of a: 6<br />

value of a: 7<br />

value of a: 8<br />

value of a: 9<br />

value of a: 10<br />

Try the following example program to understand loop control statements (for statement) to<br />

print loop with the range i until j in Scala Programming Language.<br />

object Demo {<br />

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

var a = 0;<br />

// for loop execution with a range<br />

60

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

Saved successfully!

Ooh no, something went wrong!