May 2017
Intermediate to advanced
414 pages
13h
English
Inside the file, define the actor as follows:
class SummingActor extends Actor { // state inside the actor var sum = 0 // behaviour which is applied on the state override def receive: Receive = { // receives message an integer case x: Int => sum = sum + x println(s"my state as sum is $sum") // receives default message case _ => println("I don't know what are you talking about") } }
Here, we are not creating an actor, we are only defining the state and behavior.
Read now
Unlock full access