Skip to content

Instantly share code, notes, and snippets.

@jjhop
Created January 26, 2012 02:41
Show Gist options
  • Save jjhop/1680621 to your computer and use it in GitHub Desktop.
Save jjhop/1680621 to your computer and use it in GitHub Desktop.
scala.actors zabaway ze ScalaIDE
package info.jjhop.mp
import scala.actors._
case class Name(val name:String) {
override def toString():String = name
}
class GreetingsActor extends Actor {
def act = {
loop {
receive {
case Name(n) => println("Dostalem: " + n.toString)
case "quit" => {
println("robimy wypad")
exit()
}
case _ => println("???")
}
}
}
}
object MyProgram {
def main(args: Array[String]): Unit = {
println("Hello world!")
var vals = List(Name("Rafal"), Name("Kamilka"), Name("Zosia"), "Hello", 1L) //
val a = new GreetingsActor
a.start
vals.foreach { i => a ! i}
a ! "quit"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment