Last active
April 17, 2016 14:13
-
-
Save Krasnyanskiy/fd3ebb5eb200e1c3436dc836c9bcc2ba to your computer and use it in GitHub Desktop.
-scala: fixme (!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 10 | |
class Condition(closure: (=> Unit) => Condition)(cmd: => Unit) { | |
def until(condition: => Boolean) = { | |
if (condition) { | |
cmd | |
closure(cmd) | |
} | |
} | |
} | |
def repeat(cmd: => Unit) = new Condition(repeat)(cmd) | |
repeat { | |
println(i) | |
} until { | |
i = i - 1; i > 0 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix