Created
March 16, 2016 12:56
-
-
Save emadhegab/102dab70303ba7f6bab3 to your computer and use it in GitHub Desktop.
extension to make Ruby Like times for swift
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 times(b: (Int) -> ()) { | |
for i in 0..<self { | |
b(i) | |
} | |
} | |
} | |
3.times { print($0) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment