Skip to content

Commit cd60e56

Browse files
author
mdodsworth
committed
more examples
1 parent cb395d7 commit cd60e56

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

another-actor-example.scala

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import scala.actors.Actor
2+
import scala.actors.Actor._
3+
4+
val countActor = actor {
5+
loop {
6+
react {
7+
case "how many?" => {
8+
println("there are "+mailboxSize.toString+" in the queue right now")
9+
}
10+
}
11+
}
12+
}
13+
14+
countActor !
15+
countActor ! 2
16+
countActor ! 3
17+
countActor ! 4
18+
countActor ! 5
19+
countActor ! "how many?"
20+
countActor ! "how many?"
21+
countActor ! 6
22+
countActor ! 7
23+
countActor ! "how many?"

0 commit comments

Comments
 (0)