egslava

Scala while-else cycle

Nov 4th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.24 KB | None | 0 0
  1. object Until{
  2.   var expr_cache: Boolean = false;
  3.  
  4.   def until(expression: => Boolean)(code: => Unit) = {
  5.     expr_cache = expression
  6.     while (expression)code
  7.     this
  8.   }
  9.  
  10.   def els(code: => Unit): Unit = if (!expr_cache)code
  11. }
Advertisement
Add Comment
Please, Sign In to add comment