summaryrefslogtreecommitdiff
path: root/test/pending/continuations-run/foreach.scala
blob: 4daade452c8dbb03af4bb7b711e68841981cbe17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// $Id$

import scala.util.continuations._

import scala.util.continuations.Loops._

object Test {

  def main(args: Array[String]): Any = {


    reset {

      val list = List(1,2,3,4,5)

      for (x <- list.suspendable) {

        shift { k: (Unit => Unit) =>
          println(x)
          if (x < 3)
            k()
          else
            println("enough is enough")
        }

      }

    }


  }

}