Created
July 23, 2014 19:06
-
-
Save dboundz/d1ce8261c0be7e50e9e6 to your computer and use it in GitHub Desktop.
Swift extensions...
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
extension Int { | |
func repeat(task: () -> ()) { | |
for i in 0..self { | |
task() | |
} | |
} | |
} | |
500.repeat { | |
println("hello") | |
} | |
// Would print 'hello' 500 times |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment