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

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

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

Infinite Loop:<br />

A loop becomes infinite loop if a condition never becomes false. If you are using <strong>Scala</strong>, the while loop is the best<br />

way to implement infinite loop as follows<br />

object Test {<br />

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

var a = 10;<br />

// An infinite loop.<br />

while( true ){<br />

println( "Value of a: " + a );<br />

}<br />

}<br />

}<br />

If you will execute above code, it will go in infinite loop, which you can terminate by pressing Ctrl + C keys.<br />

TUTORIALS POINT<br />

Simply Easy Learning

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

Saved successfully!

Ooh no, something went wrong!