summaryrefslogblamecommitdiff
path: root/test/pending/continuations-run/foreach.scala
blob: 76823e76040064be73367052d51e3006f0bd8fba (plain) (tree)
1
2
3
4
5
6
7
8
9






                                       
  
                                        

    
           
      
                                
      
                                   
        






                                       
        
       
      
     

    
   
  
 
// $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")
        }
        
      }
      
    }
    
    
  }
  
}