Just playing with Scala foreach method :
package myScalaProjectobject thePlayer{var myList = List ("Zvika","Dalit","Gal","Shahaf","Lior")myList foreach ( nextItem => println (nextItem))var myMap = Map ("1"->"Golda meir" , "2"->"Fohad be eliazer" , "3"->"Stas aamos")myMap foreach ( nextItem => println (nextItem._1 + ":" + nextItem._2))}object myScalaMain {def main(args: Array[String]): Unit = {thePlayer}}
And the Result:
Zvika
Dalit
Gal
Shahaf
Lior
1:Golda meir
2:Fohad ben eliazer
3:Stas aamos
Please note that in order to set the scala main class in NetBeans ide use the following Dialog :
אין תגובות:
הוסף רשומת תגובה