Created
November 12, 2013 23:45
-
-
Save ismaelga/7440882 to your computer and use it in GitHub Desktop.
my repeat
This file contains 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
def myRepeate(command: => Unit) = new { | |
def until(condition: => Boolean): Unit = | |
if (condition) () | |
else { | |
command | |
until(condition) | |
} | |
} | |
var x = 0 | |
myRepeate { | |
x += 1 | |
println(x) | |
} until (x >= 10) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment